非常简单<a href="" link="" not="" working=""

时间:2015-12-07 12:59:21

标签: html hyperlink

="" 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>

2 个答案:

答案 0 :(得分:3)

这是因为大多数网页都不允许您在框架中显示它们。 如果您打开浏览器的JS控制台,您将看到类似

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

将它保存为个人电脑上的.html文件并运行它。该链接将起作用。

更多信息: How to set 'X-Frame-Options' on iframe?

答案 1 :(得分:0)

如果你想在你的网站上显示链接,你可以在你的代码中使用iframe,这样它在我的电脑上工作正常

<iframe src="www.google.com" height="500" width="500"></iframe>