Open Doc to GDV

HTML
<a class="link" target="_blank" href="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"> PDF File </a>
CSS
JAVASCRIPT
//open href to .pdf or .doc/.docx to GoogleDocViewer //https://docs.google.com/gview?url= $(document).ready(function(){ (function(){ $('a').each(function(i,e) { var href = encodeURIComponent( $(e).attr('href') ), target = $(e).attr('_target'); console.log( href ); console.log( 'https://docs.google.com/gview?url='+href ); $(e).click(function(ev) { ev.preventDefault; window.open('https://docs.google.com/gview?url='+href, target); }); }); })(); }); //documentation: //https://gist.github.com/izazueta/4961650 //https://productforums.google.com/forum/#!topic/docs/2xgcAuJJMuU
Expand for more options Login