Google Search Results Sanitizer

By Anmar Mansur Last update Nov 7, 2008 — Installed 1,339 times.

Needs unescape()

in
Subscribe to Needs unescape() 1 post, 1 voice

ping Scriptwright

Urls need to be unescaped or the link will break for urls like http://somedomain.com/page.php?param=somevalue

-------------- snip ------------------
var links = document.evaluate("//a[@class='l']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

for (var i = 0; i < links.snapshotLength; i++) {
links.snapshotItem(i).href = unescape(links.snapshotItem(i).href.replace(/.*&q=([^&]*)&.*/, "$1"));
}
-------------- snip ------------------

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel