popup blocker problem

J

JoeM

I noticed with users with popup blockers, like the one in windows XP sp2
have problems with the code below.

When a user clicks on the link the popup blocker blocks the window from
opening. In XP SP2, the popup block is set to medium. Any suggestions, or
modifications to code will be appreciated.

<Start HTML CODE>

<SCRIPT language=JavaScript1.2 src="javascript.js"></SCRIPT>

<a href="imagename.JPG" onClick="image('Title', 'image location', 'width',
'height', 'window name');return false">

<End HTML CODE>

<Start js file code>

function image(title, path, width, height, windowname,scrollbars)

{

text = "<head><META HTTP-EQUIV='Pragma' CONTENT='no-cache'></head>\n"

text += "<html>\n<head>\n<title>" + title + "</title>\n";

text += "<Body leftMargin=0 topMargin=0>\n";

text += "<center>\n";

text += "<Body bgcolor=BLACK>\n";

text += "<img border='0' src='" + path + "' alt='" + title + " '></A>\n";

text += "</center>\n</body>\n</html>\n";

setTimeout('windowProp(text, '+ width + ',' + height + ',' + '"' +
windowname + '","' + scrollbars + '" )', 0);

}

function windowProp(text, width, height, windowname,scrollbars)

{

newWindow = window.open('', windowname
,'scrollbars='+scrollbars+',width='+width+',height=' +height
+',left=0,top=0');

newWindow.document.write(text);

}

<End js file code>
 
S

Steve Easton

Try adding / changing the following"

newWindow = window.open('', windowname
,'scrollbars='+scrollbars+',width='+width+',height=' +height
+',left=0,top=0');

newdocument = newwindow.document; // added

newdocument.write(text); // note the change

newdocument.close(); //added


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
J

JoeM

Adding in the code you gave me it opens in a new window but does not add the
passed information into the created popup window. And IE6 SP2 popup block
still blocks the popup. Any more suggestions will be looked at. Thanks
again.
 
J

JoeM

The problem was that
newWindow = window.open('', "windowname"
,'scrollbars=yes,width=500,height=400,left=0,top=0');

newWindow.document.write(text);

needed to be in the same function as the text += code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top