0

I'm trying to link to a book on Amazon. I've boiled it all down to a very simple piece of code which does not take me to Amazon when I click on the link. If I just put the address into a browser then the page loads fine. How can something so simple not work?

<!DOCTYPE html>
<html>
<body>

<p><a href="https://rads.stackoverflow.com/amzn/click/com/093849743X" rel="nofollow noreferrer">Amazon Link</a></p>

</body>
</html>
user740360
  • 57
  • 1
  • 1
  • 5

2 Answers2

3

It's because most webpages don't allow you to display them in frames. If you open the JS console of your browser you will see something like

Refused to display 'http://www.amazon.com/dp/093849743X/?tag=stackoverfl08-20' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

Just save it as a .html file on your pc and run it. The link will work.

More information: How to set 'X-Frame-Options' on iframe?

Community
  • 1
  • 1
davidgiga1993
  • 2,695
  • 18
  • 30
0

well it works fine on my pc if you want to show the link on your website you can use iframe in your code like

<iframe src="www.google.com" height="500" width="500"></iframe>
rohitsaroha125
  • 126
  • 1
  • 2
  • 16