Printer Friendly Redirect
Redirects to printer friendly pages if it can find one. A printer icon appears in the corner of such pages. Clicking it turns on the redirect. Clicking again turns it off. Printer friendly pages are cleaner than articles and not on multiple pages.
When it detects that there is a printer friendly version to a page, a small printer is displayed in the top right, which is clickable to change the preference so it will go to the printer friendly page automatically. Similarly, when on a printer friendly page, the printer is displayed and is clickable to disable the preference to redirect for that website in the future.
The size of the printer icon is customisable, just look at the top few lines of code for details of how to change it.
Any suggestions for changes or other comments would be welcome in the comments!
Changelog
UPDATE (27-April-2007): Back button problem now fixed, thanks parallel lines.
UPDATE (26-April-2007): Managed to put an extra close bracket in on the last update and not notice. Fixed this now.
UPDATE (24-April-2007): Grey bar across top of BBC news no longer on top of printer icon.
Summary of Earlier Changes
- Printer image slightly larger, also fixed in top right.
- No longer a pop-up box, just a small printer icon in the top corner.
- Remembers which websites to redirect on.
- KNOWN ISSUE: If values are reset in about:config instead of toggled, it no longer works for that page until firefox is restarted.
Did this script help you? Please donate, but don't feel forced to! 
You could comment on this script if you were logged in.
23 comments
You could comment on this script if you were logged in.

login to vote
dingar, I am aware of problems such as this, but this script isn't the most sophisticated script in the world. My aim has been to ensure that it will redirect on most pages that have a print friendly version, not to ensure that it won't on pages selling printers etc. Without spending a very long time trying to find a way around this issue, it would be impossible to fix this particular problem. I guess this is just the problem with trying to write a script for every page on the internet.
I guess all I can suggest is to hit the printer again if you end up on a page that you don't expect to be on, and manually look for a printer friendly link.
login to vote
Znerp, thank you for your reply. I love this script.
Look PCWorld please, it will jump to a page talk about priter. Such as
http://www.pcworld.com/article/id,130869-page,1...
login to vote
UPDATE: now works for newscientist.com
login to vote
dingar, on the whole I've tried to avoid using javascript links, and very few sites seem to use them. On the whole when clicking them, I've found that it attempts to actually send the page to a printer and it would be annoying to have that pop up every time. I know it would be possible to block this from happening, but I'm happy to have the site load for most of the major news sites as it does.
I looked at the site that you linked, and I've found the link you're referring to, but not being familiar with Chinese and due to the reasons listed above, I don't think I'll add it to the script. Feel free though to add as many extra lines as you like to your version though, half the fun of some scripts is customising them for your own use. Glad you like the script though!
login to vote
Look this page
http://news.sina.com.cn/c/2007-03-07/1704124555...
and I add
allLinks[i].href.match("javascript:LoadPrintJs()") ||
login to vote
i love this script! but i cant get it to go back to the page i came from, it keeps taking me back to the print friendly page. what gives?
login to vote
UPDATE: now works for boston.com
login to vote
UPDATE: now works for citypaper.net
login to vote
Thanks for the feedback Robert Litzke. I've grown the printer icon, and made it easily customisable from the top of the source file.
login to vote
Works well, but the icon could be a bit larger... it's like 10x10 pixels, hard to notice.
login to vote
UPDATE: now works for sun-sentinel.com
login to vote
UPDATE: now works for wral.com.
login to vote
UPDATE: now works for uk.news.yahoo.com
login to vote
UPDATE: now works for startribune.com.
login to vote
UPDATE: now works for news.com and nytimes.com. Thanks for the feedback, meno.
login to vote
hmmm...didn't seem to work on news.com or nytimes.com for me
login to vote
Thanks, znerp.
I prefer the whitelist because I already have my favorite news and entertainment sites hacked with css and I seldom need to bother with printer friendly versions.
login to vote
As it is, you can cut a lot out of it if that's how you'd like to use it. I'd suggest keeping it as-is for a few days though, because the box only pops up once per host, so after a while you'll see it much much less. That said, you'd want to make the code simply...
var allLinks = document.getElementsByTagName('a'); if (document.location.href.match("print") == null) { for (var i = 0; i < allLinks.length; i++) { if (allLinks[i].href.match("print.html") || allLinks[i].href.match("print.shtml") || allLinks[i].href.match("/print/") || allLinks[i].href.match("/printer_friendly_story/") || allLinks[i].href.match("&pagewanted=print") || allLinks[i].href.match("/print?") || allLinks[i].href.match("type=printable") || allLinks[i].href.match("&printer=1")) { document.location = allLinks[i].href; }//if (allLin... }//for (var i ... }//if (docume...... to get what you asked for.
login to vote
I really like this but I hate the popup box. Can you show me what to remove to get rid of it?
I'd rather edit the includes from the universal http:/ /* to my own whitelist.
login to vote
sorry, Junk Blocker, I can't seem to roll that into this script well, and it didn't seem to work for me, so I've made simple redirect just for wired.com ... it seems to work in all the articles I tried; it's at http://userscripts.org/scripts/show/7999. I'm not familiar with wired.com at all, so forgive me if I've made a glaring oversight. Both scripts ought to work well together.
login to vote
For wired.com, the logic is something like this:
if (document.location.hostname.match(/wired\.com$/) && document.location.href.match(/.\.html/) && !document.location.href.match(/_pr\.html/)) { var newurl = document.location.href.replace(/\.html/, '_pr.html'); document.location = newurl; return; }if you wanna roll that up into the script.
login to vote
actually, yeah, I've done that. I'm an issue with it that I'm trying to work out before uploading it. The only way that I can see of doing this is by using GM_setValue, and these can be changed easily in about:config, but would take me more time than I want to spend at the moment to devise a more elaborate way of changing them. The issue I'm having is that it all works as expected, but if I reset the value in about:config, it throws a hissy fit and won't work. I think I'm doing something wrong in the GM_getValue, but I don't know what.
login to vote
Sweet script, makes reading the news on-line so much better, but that pop-up is starting to piss me off have you considered getting it to remember what you said for each domain?