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
Add a ment  | 

5 Answers 5

Reset to default 7

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