473,396 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 3095
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

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

Similar topics

1
by: Ozzy | last post by:
We've got a CDROM with a Flash Projector movie on it. Within the Flash projector (which is already burned on CDROM...can't change it), we have the typical getURL fuctions to open a Web browser and...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
1
by: fogwolf | last post by:
First a basic outline of what I am trying to do: I want to have a page spawn a pop-up when you click "submit" on its form. On this pop-up page there will be another form. When you click "submit"...
2
by: Jenny | last post by:
In the code below, I can write html content var t='<body BGCOLOR=blue>' for a new window. But if it contains javascript, such as var t='<body onload="window.open('new1.html')">', this code will...
8
by: Jeff User | last post by:
Hello all I am working on creating a Web application I am using C# code behind ..NET1.1 Rather than navigate to a new window, I want to open a seperate IE window when the user clicks a...
2
by: cgrady | last post by:
I'm working on part of a larger project, and in trying to debug one aspect, I've got a small test file to work with. The code is practically identical (all important aspects match word for word)...
6
by: Daz | last post by:
Hello everyone, I would like to open a child window from the parent, and add an onload event listener to the child window which will tell the parent when the document has loaded. As far as I...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
2
by: Beni Rose | last post by:
I'm trying to open a new window using window.open and then print that window once it's loaded. It works fine in Firefox, but not at all in IE. No matter what I put in my onload, it gets ignored....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.