Embedding Google map in post

DataDan

Mama says he's bona fide
Long ago, there was a feature for embedding a Google Map in a post. I used it in 1Rider to show a certain POV leading up to a hazard, or to the location of a crash that had occurred. Looking back on those posts, I now see only blank space where the embedded street view used to be.

Is the "gmap" feature still available, and if so how can I use it?
 

insyder

Like a Boss.
Staff member
I don't remember ever using the map feature, though I've seen the maps on here. I do know that the embed code for GMaps has changed over the years.

Can you do me a favor and post a link to the threads in question? I can take a look and see if the GMap BBcode can be revised.
 

insyder

Like a Boss.
Staff member
New BBCode! {maps} (Use the squared ones, of course)



When you go to Google Maps:
  • Make your map/route
  • Hit the "share" button
  • Click "Embed a map"
  • Click "COPY HTML"
  • Go to BARF
  • Type the {maps} BBCOde
  • Paste the code provided by Google
  • Type the closing {/maps} BBCode

:port

It doesn't preview right, but if you follow the method above it should work just fine
 
Last edited:

cheez

Master Of The Darkside


Hrm. No worky for me.
 
Last edited:

DataDan

Mama says he's bona fide
 
Last edited:

bikeama

Super Moderator
Staff member
LINK Does not embed?

 
Last edited:

insyder

Like a Boss.
Staff member
 

bikeama

Super Moderator
Staff member
insyder Brian This is a test.




Code below with square brackets replaced with { }. Everything looks the same. I did copy your code and is is above in the blank area. So something is there but can not see it.
EDIT: it is blank on preview but shows 404 not found when message submitted. Used Mod powers to copy your text.

Your text
{maps]}<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2398.7703087732652!2d-71.35992402096764!3d44.358554587100336!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x4cb3f461459c4971%3A0xefc9a5c3438bb4b9!2sRandolph%2C+NH!5e0!3m2!1sen!2sus!4v1561264336500!5m2!1sen!2sus" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>{/maps}

My text
{MAPS}<iframe src="https://www.google.com/maps/embed?pb=!1m52!1m12!1m3!1d697824.0207521071!2d9.950251079217455!3d46.90517507862801!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!4m37!3e0!4m5!1s0x47837de0ccd714ed%3A0x61362545c9e38802!2sHotel+Nolda%2C+Via+Crasta+3%2C+7500+St.+Moritz%2C+Switzerland!3m2!1d46.484449!2d9.832839!4m3!3m2!1d46.5829118!2d10.4370864!4m3!3m2!1d46.5405247!2d10.4327889!4m3!3m2!1d46.528686099999994!2d10.4533896!4m3!3m2!1d46.5328976!2d10.469598!4m3!3m2!1d46.5745863!2d10.538183499999999!4m3!3m2!1d46.6410726!2d10.5980464!4m5!1s0x0%3A0xf9b1f8c5c66842b6!2sKrumers+Post+Hotel+%26+Spa!3m2!1d47.3286879!2d11.1876619!5e0!3m2!1sen!2sus!4v1561230511786!5m2!1sen!2sus" width="400" height="300" frameborder="0" style="border:0" allowfullscreen></iframe>{/MAPS}
 
Last edited:

bikeama

Super Moderator
Staff member



No question your map is working in your post. It does not work when quoted or copied. I must be missing something I can not see. I am on a MBP is that makes any difference. See my post above for text of your link and text of my link.


Bill
 

berth

Well-known member
No question your map is working in your post. It does not work when quoted or copied. I must be missing something I can not see. I am on a MBP is that makes any difference. See my post above for text of your link and text of my link.


Bill

Quoting won't work because it's quoting all of the HTML iframe goobledygook that's generated rather than just the maps URL.
 

DataDan

Mama says he's bona fide

Use of the {maps} feature evidently requires HTML permission. You have it, so your posts can access the feature. My posts cannot. In fact, I cannot use it even when quoting your post, because the poster is me, not you.


My question is answered: We regular users cannot embed maps. For now, the feature exists but requires HTML permission, which is restricted to admins.
 
Last edited:

DataDan

Mama says he's bona fide
Got it.




 
Last edited:

DataDan

Mama says he's bona fide
Brian,

Scratch that guess about HTML permission...

Notice the code generated in your successful post #8:


var strInputString = '<iframe src="https://www.google.com/maps/embed?
pb=!1m18!1m12!1m3!1d2398.7703087732652!2d-71.35992402096764!3d44.358554587100336!2m3
!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x4cb3f461459c4971
%3A0xefc9a5c3438bb4b9!2sRandolph%2C+NH!5e0!3m2!1sen!2sus!4v1561264336500!5m2!1sen!2sus"
width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>';

strInputString = strInputString.replace("<iframe src=\"", "");

strInputString = strInputString.replace("\" width=\"600\" height=\"450\" frameborder=\"0\" style=\"border:0\" allowfullscreen></iframe>", "");

document.write('<iframe src=\"' + strInputString + '\" width=\"600\" height=\"450\" frameborder=\"0\" style=\"border:0\" allowfullscreen></iframe>')


Now look at the code for my failed post #6:

var strInputString = '<iframe src="https://www.google.com/maps/embed?
pb=!1m18!1m12!1m3!1d2398.7703087732652!2d-71.35992402096764!3d44.358554587100336!2m3
!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x4cb3f461459c4971
%3A0xefc9a5c3438bb4b9!2sRandolph%2C+NH!5e0!3m2!1sen!2sus!4v1561264336500!5m2!1sen!2sus"
width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>';

strInputString = strInputString.replace("<iframe src=\"", "");

strInputString = strInputString.replace("\" width=\"600\" height=\"450\" frameborder=\"0\" style=\"border:0\" allowfullscreen></iframe>", "");

document.write('<iframe src=\"' + strInputString + '\" width=\"600\" height=\"450\" frameborder=\"0\" style=\"border:0\" allowfullscreen></iframe>')


The code is removing the initial <iframe src=" then inserting it in the document.write.

However, in my version, the "<" and the quote are represented as < and " so the replace doesn't work as intended.

My solution is to omit the <iframe src=" from the post. The replace (which would delete it anyway) has no effect, and the document.write inserts it properly.
 
Last edited:
Got it.


ha! got it ... :thumbup



thanks, insyder and DataDan! :party
 
Last edited:

bikeama

Super Moderator
Staff member
Looks like that works.

My ride for July 29th this year. :teeth:ride:teeth


+1 thanks, to insyder and DataDan!
 
Last edited:

berth

Well-known member
Looks like that works.

My ride for July 29th this year. :teeth:ride:teeth




+1 thanks, to insyder and DataDan!

Quoting seems to work now too.
 

insyder

Like a Boss.
Staff member
The bottom line is the options that GMaps offers in regards to embeds kind of sucks.

- Try and wrap a link with your own iframe and it doesn't work.
- If you're not careful with their embed code, you can break it.
- If you want to just allow any code and let VBulletin wrap an iframe around it, you run the risk of some joker iframing a scat porn or malware site on a popular page in the 'sink. This site gets the traffic, so its a totally reasonable risk/fear.

So what I built was a little js that takes the full iframe from GMaps to make it super easy for the user(I hope). It then strips the front end and rear end of the code to temporarily neuter the code, then reapplies that same code itself so that VBulletin is the one building the iframe and not the user. Fairly secure, and works "ok"...

If I have a minute, I'll see if I can use js to dump the GMaps iframe tags into a regex for that trim operation. Perhaps that will make it robust in only accepting GMaps code...(?)

Now if G could change it up to offer up maps like they do with YouTube videos, then it could be nice and easy and secure. :nchantr

IDK, they're playing games with Google maps and licensing and what not for devs and using maps now a days anyway so who knows what might change or not change. G knows that GMaps in all its forms is a super useful content piece that they have. Monetizing its use is just part of the business model.
 
Top