这两个 HTML 锚点有什么区别?
我尝试使用链接检查器查找任何损坏的链接,但不包括第二个链接,displayedPage.html 显示 404 错误,但它不会显示在链接检查器的报告中。 两个有什么区别? 为什么第二个没有被检查为链接?
<a href="showpage.go?page=mypage&room=yours">
<span>my own room</span>
</a>
第二:
<a onclick="javascript:window.open('my/displayedPage.html', '',
'width=590,height=450,scrollbars=no,resizable=no'); return true;"
href="javascript:void(0)">Show Me</a>
I tried to use Link Checker to find any broken links, but the second one is not included, the displayedPage.html shows 404 error, but it will not show in the Link Checker's report. What is the difference between the two <a></a>
? Why wasn't the second one being checked as a link?
<a href="showpage.go?page=mypage&room=yours">
<span>my own room</span>
</a>
second:
<a onclick="javascript:window.open('my/displayedPage.html', '',
'width=590,height=450,scrollbars=no,resizable=no'); return true;"
href="javascript:void(0)">Show Me</a>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
第二个没有可以使用您正在使用的链接检查器进行检查的
href
属性。据推测,您使用的程序不理解
javascript:
协议和/或忽略除http
和ftp
之外的任何其他协议。The second one does not have an
href
attribute that can be checked with the link checker you are using.Presumably, the program you are using does not understand the
javascript:
protocol and/or ignores any other protocols thanhttp
andftp
.您的工具似乎忽略了 javascript 链接。 第二个链接不是纯 html 链接,而是通过调用 javascript 创建的链接。
It seems that your tool ignores javascript links. The second link is not a pure html link, it's a link created by calling javascript.
第二个不是有效的链接,它需要 javascript才能工作,链接检查器可能没有检查(我猜它本质上是在进行静态分析)。
您应该始终将 href 设置为要打开的链接并附加 javascript 增强行为,例如:
The second isn't a valid link, it requires javascript in order to work, something the link checker probably isn't checking (it is doing essentially static analysis I guess).
You should always have the href set to the link you want to open and attach javascript enhanced behavior, something like:
因为在第二个浏览器中,当您单击此链接时,浏览器只会执行 javascript。
该脚本正在使用给定的参数在新窗口中打开链接
because in second one browser just executes javascript when you click this link.
this script is opening link in new window with given params
链接检查器不认识 javascript
The Link Checker doesn't know javascript