0

I have a <href> link in the html code which works well when not put inside the <iframe> tag and the same link gives issue when put inside the <iframe>

Below is the code:

<iframe frameborder="0" src="http://localhost/TestingLink.htm"></iframe>

Code for TestingLink.htm:

<a href="http://www.google.com">Click me</a>
Albzi
  • 15,201
  • 5
  • 43
  • 61
user179516
  • 317
  • 4
  • 10
  • 20

1 Answers1

2

It's due to Google adding DENY to the X-Frame-Options header. Meaning you cannot embed that site in an iframe.

DENY: The page cannot be displayed in a frame, regardless of the site attempting to do so.

And this is the error you will see when you debug the page with the iframe on:

Load denied by X-Frame-Options: https://www.google.co.uk/ does not permit cross-origin framing.

Read more about X-Frame-Options here : https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options

Nick R
  • 7,564
  • 2
  • 20
  • 32