Using javascript to print some other page

DORIAN COLLIER    JAN 27

Have you ever needed to print different web page than the one being viewed? This is a requirement for one of our current projects. In searching for an answer I found a lot of forum posts that didn't quite do the trick. I created a lil' Javascript function that'll get the job done. Hopefully somebody, somewhere, finds it useful.

The basic idea is to dynamically create an iframe, load your content, set focus on the iframe, then trigger the browser print function for that iframe.

You can download the code here...
http://deesea.com/keep/PrintUrl.js.zip

Tested in FF3 and IE 7 and 8.

NOTE: The function uses jQuery, but you shouldn't have much trouble un-jQuerying it if you need to.

Comments

DotNetKicks.com   3/2/2010 6:46:19 AM #

Using javascript to print some other page

You've been kicked (a good thing) - Trackback from DotNetKicks.com


JMP   3/2/2010 6:29:40 PM #

Um, file not found?


BMP   3/3/2010 8:34:05 AM #

Thats what you get when you  run microsoft products


Dizzledorf   3/3/2010 9:41:15 AM #

@BMP: Riiight. Lousy "M$"! Because Apache will automatically find and replace all your broken links, and get you a beer while you wait.


dorian   3/3/2010 1:54:28 PM #

Enough from the peanut gallery! Smile

The link is fixed. Enjoy it and let me know if it's useful for you.


darktalker   3/5/2010 4:48:22 AM #

it doesn't work for a cross-domain url
but thx any way for the solutioin Smile


jaceju.net   3/5/2010 10:20:39 AM #

Pingback from jaceju.net

網站製作學習誌 » [Web] 連結分享


274.defutbolazo.com   5/20/2010 10:35:36 AM #

Pingback from 274.defutbolazo.com

2003 Chrysler Sebring Battery, Sebring Clearance Brake Rotors


Comments are closed

Widget Twitter not found.

Root element is missing.X