href "javascript: void(0);" always flagged as invalid

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
StefanM
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 1
Joined: Sun Jan 01, 2017 8:59 am

href "javascript: void(0);" always flagged as invalid

Post by StefanM » Sun Jan 01, 2017 9:05 am

I'm having a big problem with links with this href:

javascript: void(0);

I know it may not be best programming practice to use this for links that should not do anything, but I have thousands of these being flagged, so I can't easily find the "real" broken links. It's like looking for a needle in a haystack.

I have added that link text to Validator Engine Options --> Link Checking --> Link Filters under section "Don't check (exclude) these links:", but I still get this error on every one of those links:

[error computing path] (javascript: void(0);) -- Can't compute abs path -- Info: bad character in scheme data section

I think the Validator is trying to parse 'javascript: void(0);' and failing.

--> Is there a way to completely ignore (don't parse, don't compute the absolute path, don't do anything at all) these links? I have tried everything I can think of, including "Path Mapping" 'javascript: void(0);' to an empty string.

Many thanks!

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3242
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: href "javascript: void(0);" always flagged as invalid

Post by Albert Wiersch » Mon Jan 02, 2017 10:24 am

Hi Stefan,

The link filters only work after a link is converted to an absolute link and it is failing before that so the link filters have no effect.

The space character is causing the parse error. "javascript:" is a considered "pseudo-protocol", by the way, but CSE HTML Validator is trying to parse it as a real URI.

As per our email conversation, the easiest way to address this issue is to simply remove the space character. The error should go away and the link should be reported as "not checked".
Image
Albert Wiersch

Post Reply