1

I'm trying to add an Embed code in my Google Site

In the HTML, I'm trying to use <iframe> to display other sites in .aspx and .php.

<iframe> works totally fine with .aspx site. However, it does not display .php content.

To display .aspx, this is how my <iframe> part code looks like, which works fine.

<iframe              
    src="https://XXXX.aspx" 
    frameborder="0"
    scrolling="no" 
    style="overflow:hidden;height:100%;width:100%" 
    height="100%" 
    width="100%">
</iframe>

However, when I added a .php site to iframe, it either shown nothing or returned 404 error.

The following was what I tried, and both of them did not work.

This returns a blank page

<iframe              
    src="https://www.php.net/manual/en/tutorial.firstpage.php" 
    frameborder="0"
    scrolling="no" 
    style="overflow:hidden;height:100%;width:100%" 
    height="100%" 
    width="100%">
</iframe>

AND

This returns a 404 error

<iframe              
    src=<?php print "https://www.php.net/manual/en/tutorial.firstpage.php" ?>
    frameborder="0"
    scrolling="no" 
    style="overflow:hidden;height:100%;width:100%" 
    height="100%" 
    width="100%">
</iframe>

Please help!

L.J.
  • 11
  • 3

2 Answers2

0

This problem occurs when you enter wrong address in your Iframe tag. please check that or tell us that address you want put in iframe.

Pooya Behravesh
  • 131
  • 2
  • 10
0

You can test it out by putting

<!DOCTYPE html>
<html>
<body>

<iframe src="https://www.php.net/manual/en/tutorial.php">
</iframe>

</body>
</html>

into a new html doc and then open with a browser, you will see that

Refused to display 'https://www.php.net/manual/en/tutorial.php' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

in the broswer's console.

https://stackoverflow.com/a/27359031/8062552

ctzw
  • 1
  • Be warned some sites will not want to be in iframes and much like blocking hotlinking of images so if it does not work even though the code is sound that might be why. – Michael Nelles Mar 16 '20 at 02:10