admin管理员组文章数量:1303068
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>
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>
Share
edited Aug 12, 2009 at 15:16
Sinan Ünür
118k15 gold badges200 silver badges343 bronze badges
asked Aug 12, 2009 at 15:12
derrdjiderrdji
13.3k22 gold badges69 silver badges79 bronze badges
1
- 2 you cant control+click, shift+click, or right click > open in a new window, on the 2nd link in many browsers. – Allen Rice Commented Aug 12, 2009 at 15:32
5 Answers
Reset to default 7The 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 than http
and ftp
.
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.
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:
<a onclick="window.open(this.href, '',
'width=590,height=450,scrollbars=no,resizable=no'); return true;"
href="my/displayedPage.html" target="_blank">Show Me</a>
because in second one browser just executes javascript when you click this link. this script is opening link in new window with given params
The Link Checker doesn't know javascript
本文标签: javascriptWhat is the difference between these two HTML anchorsStack Overflow
版权声明:本文标题:javascript - What is the difference between these two HTML anchors? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741695960a2393006.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论