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,431
  • 6
  • 46
  • 63
user179516
  • 337
  • 4
  • 11
  • 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,704
  • 2
  • 22
  • 32