PDF/PPT/TIF viewer with Google docs

By Koonies Last update Oct 24, 2009 — Installed 21,124 times.

onclick instead of href

in
Subscribe to onclick instead of href 1 post, 1 voice

_bugmenot_ User
FirefoxWindows

Sometimes you already know the link won't work in Googledocs because it points to an intranet or requires authorization. Or you want to download the file directly, or open it in an external program. Or you don't want to leak the url to Google. Or you just want to bookmark the link or mail it to someone.

The script could leave the href as it is and use an onclick event instead:

l[i].setAttribute('onclick', 'window.open("http://docs.google.com/viewer?url=' + l[i].href + '"); return false');

or

l[i].addEventListener('click', function(evt){
window.open("http://docs.google.com/viewer?url=" + this.href);
evt.preventDefault();
}, true);

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