Forum Moderators: open
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>