469,362 Members | 2,375 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

window.open not working onload

I am trying to pop up a window on my web site when my page loads and I cannot get the window.open command to work when I use it with the "onload" directive. Here is a the code:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. <SCRIPT LANGUAGE="JavaScript">
  7. <!-- Idea by:  Nic Wolfe (Nic@TimelapseProductions.com) -->
  8. <!-- Web URL:  http://fineline.xs.mw -->
  9.  
  10. <!-- This script and many more are available free online at -->
  11. <!-- The JavaScript Source!! http://javascript.internet.com -->
  12.  
  13. <!-- Begin
  14. function popUp(URL) {
  15. day = new Date();
  16. id = day.getTime();
  17. eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=200,left = 262,top = 284');");
  18. }
  19. // End -->
  20. </script>
  21. </head>
  22.  
  23. <body onLoad="javascript:popUp('musicpage.php')">
  24.  
  25. This is a test...
  26.  
  27. </body>
  28. </html>
  29.  
  30.  
Addl info:
I can get this to work if I put it in button using the "onclick" directive. It is only with "onload" that it does not work.

I have turned off the Pop Up blocker in IE.

I am running IE 6.0

Any ideas?
Oct 21 '06 #1
2 2922
hi,

Here is the code you can use.


Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <script language="Javascript">
  4.             function MM_openBrWindow(theURL,winName,features){
  5.             window.open(theURL,winName,features);
  6.             }
  7.         </script>
  8.     </head>
  9.     <body onLoad="MM_openBrWindow('Images/Image1.gif','title','width=505,height=330')">
  10.                This is also a test.
  11.     </body>
  12. </html> 
It worked on my IE browser. Try your luck.
Oct 27 '06 #2
I am having a similar problem with my pop-under script too. I find a code block inserted, by what i thawt was the hosting server but turns out to be client side. My pop-under script works fine locally but when I u/l to server and view it doent werk and this mystery code appears in source!! Symantec is entering this code after download and before display to the browser. the code is as follows:

function SymError()
{
return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
return (new Object());
}

window.open = SymWinOpen;

//-->
</script>

Now, from reading forums about this issue, I understand that if you disable norton internet securities that this code injection will stop and my popunder works, . However turning off firewalls and pop up blockers will temp fix this prob FOR YOU THE WEBMASTER, What I wanna know is how can we defeat this for the sake of the average viewer.
I tried inserting a "noscript" tag in the head and it worked twice but now its like it learned it or something. :-\ Back to drawing board. Does any coders have a cheat to outsmart this so called security feature from the code side of things?? Or are we stuck telling Grandma Mavis and countless other computer illiterate ppl they needs to turn off her norton to view properly.
Oct 27 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Ozzy | last post: by
3 posts views Thread by NeverLift | last post: by
1 post views Thread by fogwolf | last post: by
2 posts views Thread by Jenny | last post: by
8 posts views Thread by Jeff User | last post: by
2 posts views Thread by Beni Rose | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.