Weird PHP Google Maps Embed Behavior in an Iframe - php

I tried to embed google maps basing on addresses.
<iframe src="<?= $map_src ?>" width="500" height="100%" frameborder="0" style="border:0" allowfullscreen=""></iframe>
The map DOES show when I use this address:
$map_src = "https://www.google.ca/maps?q=spa810+33535 Peachtree Rd. NE, Suite 530+Atlanta+GA&z=17&iwloc=near&output=embed";
However, when I try to use a different one. It shows the error
$map_src = "https://www.google.ca/maps?q=spa810+32222+McKinney+Ave+#120+Dallas+TX&z=17&iwloc=near&output=embed";
Refused to display 'https://www.google.ca/maps?q=spa810+2222+McKinney+Ave+#120+Dallas+TX&z=17&iwloc=near&output=embed' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
I am not really sure what happens in this case. Any ideas?

The "#120" caused this issue. I replaced "#120" by "Suite 120" and it works fine!

Related

Getting dynamic PHP links and iframe to work?

I'm creating a wordpress theme and am having trouble generating a video link to go into an iframe source. I've tried troubleshooting and it seems that the issue is beyond wordpress and I can't actually input any link with PHP to work with iframe. Here's an example for simplicity's sake.
<iframe src="<?php echo 'https://vimeo.com/159120552'; ?>" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
The PHP works as far as I can tell (when I inspect it, the link is in the correct place), but there appears to be a blank web document created in the iframe instead.
Am I doing something wrong or is this a known issue of iframe and PHP?
This issue not related to PHP . Its throwing an error refused to display in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Please refer How to set 'X-Frame-Options' on iframe?

Google Maps Dynamic Embed

I would like to simply ask if anyone can help me identify the issue with my code.
I am trying to display a dynamic google maps to simply show the location of every event in my website.
I did some research on it and google kindly gave this code from here:
<iframe width="450" height="250" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/search?key=API_KEY&q=record+stores+in+Seattle">
And then modified to suit my needs.
<iframe width="700" height="350" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/**MODE**?key=**API_KEY**&q=<?php echo $row['location'];"></iframe>
Now I have put the mode as search and put my developer's API key as well. I assume that q="location"
But in the end when I click on the page it only displays the map showing the whole world:
Image of Error
and as you can see I have Location: 123 Clarance Street, Sydney, New South Wales, Australia
which I've basically did is:
Location: <?php echo $row['location']?>
I've also tried:
<iframe width="450" height="250" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/search?key=API_KEY&q=123+Clarence+Street,+Sydney,+New+South+Wales,+Australia">
Just to test if there was something wrong with the PHP code. So at the moment Im stumped and don't know where to look as a lot of the things people are asking online and their solutions didn't help me in my solution.
I'm sure it could be something minor, but just hoping someone out there can help me out. Thanks in advance.

Loading iframe (google map) stored in variable loaded from mysql into a div from link

I have been trying ot hunt this down all afternoon, Im pretty new to all this and am building my first site with php
what Im trying to do is I have a google maps embed code stored in a Db which I have assigned to a variable $map, I want to inject the embed code into an existing div.
So basically a click here for map. I may be way off on what I can do here.
Im sure there is a fancier way to do this but Im just learning and trying something simple.
Sorry if this is something that is obvious.
I have no code to show as i have murdered it and it is an unhelpful mess now.
If the page has already been served to the user, you'll need to use javascript to update the div, or reload the page. I jQuery's .post method to dynamically refresh divs with using AJAX. Info at http://api.jquery.com/jQuery.post/.
I use the following code on my website, which sounds similar to what you're trying to do, but in my case, I'm passing the address to the embed code in the $addresssubjectfullgoogle variable:
<iframe width="100%"
height="350"
frameborder="1"
scrolling="no"
marginheight="0"
marginwidth="0" src="
https://maps.google.com/?f=q&t=h&ie=UTF8&output=embed&q=<?php echo $addresssubjectfullgoogle;?>&z=18&ll=<?php echo $addresssubjectfullgoogle;?>&ie=UTF8">
</iframe>
I suspect that you could do something similar except that in your case, the same could might look something like this:
<iframe width="100%"
height="350"
frameborder="1"
scrolling="no"
marginheight="0"
marginwidth="0" src="<?php echo $map;?>">
</iframe>
I hope that's helpful.

Embedded videos don't show up

I have a web site I'm working on and for some reason some of my videos don't display. The first videos display but the next one's don't.
So first one looks like this:
And the rest look like this:
I know the url's I am using are correct, I dump them to the screen and navigated to them to make sure they weren't broken. This is in chrome, same thing happens in IE.
This is the code I am using to embed:
<iframe width="420" height="315" alt="Jesus Culture" src="<?=$row?>"
frameborder="5" allowfullscreen></iframe>
I'm using similar code to yours for multiple videos on one page,
i.e.
<iframe width="425" height="349" src="http://www.youtube.com/embed/video-code" frameborder="0" allowfullscreen=""></iframe>
Make sure that your urls have the embed format. Also try to place the src value hardcoded (no php) to check whether in that case displaying multiple videos on the page will be an issue.

How to Show google map?

I am trying to show a google map using the following code:
<embed height="400" width="600" src="http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=110069293083852065946.00047e2506156dd8d127b&ll=27.727526,85.310855&spn=0.021197,0.038581&z=14&iwloc=00047e251edcecb28ba7c&output=embed">
It works fine and shows the map correctly in my chrome browser by it shows missing plugin in firefox browser.
What is wrong with this? Is the code itself wrong?
Try using an iframe, not sure where that embed tag came from.
<iframe width="400" height="600" src="http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=110069293083852065946.00047e2506156dd8d127b&ll=27.727526,85.310855&spn=0.021197,0.038581&z=14&iwloc=00047e251edcecb28ba7c&output=embed"></iframe>
There's plenty of documentation on this:
http://code.google.com/apis/maps/documentation/javascript/basics.html
I've never seen it use embed, usually you just create it using JavaScript assign it to a div tag.

Categories