Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-12-2008, 11:52 AM   PM User | #1
bigbadroo
New Coder

 
Join Date: Jan 2008
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
bigbadroo is an unknown quantity at this point
This print page function needs a tweak - anyone game?

Hi

I have this little function that opens a new page, and automatically opens the user's printer window. It works fine in IE, but in FF I get the following error:

'The page was replaced when you were trying to print. Please try again.'

Here's the code:

<a href="#" onclick="newwin=window.open('http://www.bigbadroo.com.au/popbeat/Website/acts/tribute_acts/tom_jones_experience/australian_tom_jones_experience_print.html');if(newwin)newwin.print();" value="Print"><p>Print Artist Fact Sheet</p>(A4 size)</a>

Here's a link to the page to see what's happening (not ready for public viewing):

http://www.bigbadroo.com.au/popbeat/...experience.php

Anyone know how to tweak it?

Cheers

Shaun
bigbadroo is offline   Reply With Quote
Old 02-12-2008, 12:06 PM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,614
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
It works for me. Might be your popup blocker? Anyway, if that’s the case then it might be problematic with other users as well so the best way would be to not open a new window.

Also, your link shouldn’t depend on JavaScript completely. Nowadays we’re working according to a method called “progressive enhancement”. This means we ensure that the site is working without any scripts and those scripts are only enhancements to the site for those devices that support it.

In your case you should put the URL in the href attribute in case people have JS deactivated:

Code:
<a href="http://www.bigbadroo.com.au/popbeat/Website/acts/tribute_acts/tom_jones_experience/australian_tom_jones_experience_print.html" onclick="newwin=window.open('http://www.bigbadroo.com.au/popbeat/Website/acts/tribute_acts/tom_jones_experience/australian_tom_jones_experience_print.html');if(newwin)newwin.print(); return false;"><p>Print Artist Fact Sheet</p>(A4 size)</a>
And what’s that value="Print" supposed to be? That’s not valid HTML as far as I know.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 02-12-2008, 12:22 PM   PM User | #3
bigbadroo
New Coder

 
Join Date: Jan 2008
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
bigbadroo is an unknown quantity at this point
Thanks Stephan

I'm still getting the same error in Firefox, so I'll just put a message for FF users to print it out manually.

Actually, is there a way to make it not invoke the printer dialog box if it's a Firefox browser?

Cheers

S

Last edited by bigbadroo; 02-12-2008 at 12:29 PM..
bigbadroo is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:24 PM.


Advertisement
Log in to turn off these ads.