Wednesday, October 31, 2012

Start downloading file on page load

We can do this by using window.location.href

<body onload="javascript:window.location.href='http://yoursite.com//filename.zip';">


Friday, October 26, 2012

Viewing .pdf file in a DIV

Very few lines of code and it works like charm in all browsers including IE7

<div>
  <object data="sample.pdf" type="application/pdf" width="600" height="600">
      alt : <a href="sample.pdf">sample.pdf</a>
  </object>
</div>