JavaScript bookmarklet and URL coding

By fully revealing that I do not know Javascript, I am trying to get this Javascript:

javascript:location = 'http://validator.w3.org/check?uri=' +escape(location)&doctype=Inline&charset=detect+automatically&ss=1&group=0&user-agent=W3C_Validator/1.654';

to work as a bookmark to send a URL of this format:

http://validator.w3.org/check?uri=http://www.wordpress.org&charset=%28detect+automatically%29&doctype=Inline&ss=1&group=0&user-agent=W3C_Validator%2F1.654

to the W3C vallidiator.

I am coding a Javascript URL using this encoder , but of course I am doing something wrong both in my Javascript and in the process of coding it.

Does anyone have any ideas, in particular or generally about Javascript bookmarks and URL encoding? Thanks.

+5
source share
1 answer

Two errors:

:

javascript:(function(){window.location.href='http://validator.w3.org/check?uri='+escape(window.location.href)+'&doctype=Inline&charset=detect+automatically&ss=1&group=0&user-agent=W3C_Validator/1.654';})()
+5

All Articles