473,769 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mozilla 1.5 can't create a window from onLoad event in <body> tag?

I've been running some small test programs which seem to indicate
something noticed in a larger script, that a function called from
onLoad() in the <body> tag will not succeed in creating a window
(i.e. successfully executing window.open() in Mozilla 1.5; however,
I've observed it to work a few times in IE 6.0 and Opera 5.something.
It does not seem to be a timing thing -- if I re-call the function
somewhat later using setTimeout it still doesn't succeed. However,
a call to the same function from a link (a href=...) does succeed.
I'm wondering if I've overlooked something in the documentation.

The shortest of the tests:
-----------------------------------------------------------------
<html>
<head>
<title>x</title>
<script language="JavaS cript1.2" type="text/javascript">
var k = 0;
var m = 'w1.<br>';
var w1;

function initz() {
k += 1;
if (w1) {
m += k + ": already here! ";
} else {
m += k + ": opening... ";
w1 = window.open(" ", "w1",
"toolbar=no,sta tus=yes,height= 400,width=400,m enubar=yes,scro llbars=yes,resi zable=yes,direc tories=no,locat ion=no");
}

if (!w1) {
m += k + ": not here.... ";
} else {
m += k + ": here! ";
w1.document.wri te("m=" + m + "<br>");
}
}
</script>
</head>

<body bgcolor='#53438 F' text='#ffff00' link='#ff0000' vlink='#cc0000'
onload='javascr ipt:initz()'>
<a href='javascrip t:initz()'>
xxx</a>
</body>
</html>
-----------------------------------------------------------------

which, when the link is clicked on, brings up a window with
the following text:

m=w1.
1: opening... 1: not here.... 2: opening... 2: here!
Jul 20 '05 #1
2 1494
DU
Starry Gordon wrote:

[snipped]

a function called from
onLoad() in the <body> tag will not succeed in creating a window


[snipped]

Thank god I don't have to endure such poor webpage design anymore: I
block unrequested popups and so do millions of others using browsers (or
add-ons) suppressing such nonsense.

DU
Jul 20 '05 #2
"Starry Gordon" <st**********@e taoin.com> wrote in message
news:bc******** *************** ***@posting.goo gle.com...
I've been running some small test programs which seem to indicate
something noticed in a larger script, that a function called from
onLoad() in the <body> tag will not succeed in creating a window
(i.e. successfully executing window.open() in Mozilla 1.5; however,
I've observed it to work a few times in IE 6.0 and Opera 5.something.
It does not seem to be a timing thing -- if I re-call the function
somewhat later using setTimeout it still doesn't succeed. However,
a call to the same function from a link (a href=...) does succeed.
I'm wondering if I've overlooked something in the documentation.


It could just be that Mozilla is blocking pop-ups? I believe it does this
by default unless you configure it to do otherwise.
--
Dave Ockwell-Jenner
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2162
by: Andrés Giraldo | last post by:
Hi! It's possible to register some script between the <head> and </head> actually I'm Using RegisterStartupScript and RegisterClientBlockScript, but it works on the body By the way... how can I add an attribute to the <BODY> ? I need to assign a function on the onLoad attribute of the body... how
1
3065
by: Dung Ping | last post by:
For instance, one set is: <body onload="blinking_header()" onunload="stoptimer()"> Another set is: <body onload="writemsg()" onunload="stoptimer()"> They represent two functions. How to place them in the <body> tag? Thanks.
9
19159
by: bmgz | last post by:
I need to execute a JavaScript function "onload". The only problem is I don not have access to the <body> tag as it is a part of the standard page-header include (a separate file). How could I have certain pages execute my function() onLoad? The function basically just sets the original values of fields so that I can determine if a field has been changed or not, which aleviates unnec. sql update on the backend..
3
2300
by: francescomoi | last post by:
Hi. I'm trying to insert some text between <head> and <body> but I'm not able. I try with: -------- bodyPoint = document.getElementsByTagName('body'); var myLink = document.createElement("a");
15
2251
by: Frances | last post by:
<html> <head> <script> function doIt() { var list = document.forms.product; var selItem = list.options.value; ^^^^^^^ </head>
9
7169
by: tomcadman | last post by:
Using Javascript, how do I give focus to a form text box on page load without using the <body> tag? Thanks!
2
1823
mickey0
by: mickey0 | last post by:
HI, is it possible to do this? I'd like at first execute the ONE and then the TWO. Will it work? <body onload="func1()","func2()"> </body>
8
2255
by: Prisoner at War | last post by:
Another weekend, another project, another problem.... Why should a perfectly fine function work only half-way through when called through onClick in an anchor tag?? The text fade-in script below works when called through onLoad in the <bodytag, but it "hangs" when called through onClick in <a href="#">, as follows: <script language="JavaScript1.2">
23
2241
by: Xah | last post by:
Here's a interesting case of invalid html 4 strict file. In summary, if you have <body></bodywithout any content, the file would be invalid under html 4 strict. Valid if html 4 lose. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ TR/html4/strict.dtd"> <html> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=utf-8">
0
9420
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10035
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.