Skip to content

Instantly share code, notes, and snippets.

@2dpi
Created January 9, 2013 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2dpi/4492396 to your computer and use it in GitHub Desktop.
Save 2dpi/4492396 to your computer and use it in GitHub Desktop.
JAVASCRIPT: print web page button/link
// JAVASCRIPT - PRINT PAGE
// =======================
// http://javascript.about.com/library/blprint.htm
// Add a link to locally hosted file
// <link rel=alternate media=print href="printversion.pdf">
window.print();return false;
// HTML link
// <a href="#" onclick="window.print();return false;">Print This Page</a>
// FORM button
// <input type="button" value="Print this page" onclick="window.print();return false;" />
// NB! Has delay between clicks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment