Forum Moderators: open

Message Too Old, No Replies

Pop-up never completes load

Even though all content has loaded

         

Don_Hoagie

12:54 pm on Sep 16, 2005 (gmt 0)

10+ Year Member



Hello all... yet another JS predicament for me.

I'm creating pop-up coupons for users to print. The problem I noticed is that, while the CONTENT of my pop-up always loads completely, the actual pop-up page never finishes its load. Firefox has a status bar for pop-up windows and that's where I noticed it... my page is done, but the status bar never finishes.

The problem with that seems to be that in most browsers, the "print this coupon" button does not function on command because the page has not completed loading. Sounds strange but I promise you, if you are on this pop-up page and right-click to select "stop load" or "refresh", it completes its load and the print command works properly. On some browsers the print command works with no trouble... others, the print prompt comes up only AFTER you close out the pop-up... yet others, it doesn't work at all... bleh!

function servicepartsspecialpopper(img,w,h) {

var day = new Date();
var id = day.getTime();
var ww = w+40;
var wh = h+80;
var params = 'width='+ww+',height='+wh+',resizable';

var html = '<html><head><style type="text\/css">\n'+
'body,html { text-align: center; margin-top:10px; margin-bottom:10px; background-color: white;}\n'+
'<\/style><\/head><body>\n'+
'<img src="'+img+'" width="'+w+'" height="'+h+'" border="0" alt="'+img+'">\n'+
'<form><input style="background: white; color: black; font-size: 10px" type="button" onclick="window.print();return false;" value="Click Here to Print Coupon"><\/form>\n'+
'<\/body><\/html>';

newwindow=window.open('',id,params);
newwindow.document.write(html);
}

And the HTML that pops the page:

<a href="#" onclick="servicepartsspecialpopper('special_serviceparts.jpg',450,347); return false;">Click here to view printable coupon</a>

jalarie

1:47 pm on Sep 16, 2005 (gmt 0)

10+ Year Member



newwindow=window.open('',id,params);
newwindow.document.write(html);
newwindow.document.close();

Bernard Marx

1:58 pm on Sep 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'll just emphasise the close()

Don_Hoagie

5:56 pm on Sep 16, 2005 (gmt 0)

10+ Year Member



ah crap.

thanks both

rocknbil

7:42 pm on Sep 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Heyyy . . . where did I see that code before . . . .


:-)

Don_Hoagie

11:33 pm on Sep 16, 2005 (gmt 0)

10+ Year Member



Yeah! And apparently I mauled it by mis-copying it!

Thanks again