473,804 Members | 2,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening new window and writing to it on Firefox 1.5 does not complete

Hello:

I'm stuck with a small problem using windows created using
javascript.
Here's the code of the html file.

------------------------------------------------------------------------------------------------------
<html>
<head>
<title>Today' s Date</title>
<script type="text/javascript">
function print_todays_da te() {
var d = new Date(); // get today's date.
document.write( d.toLocaleStrin g());
}
</script>
</head>
<body>
The date and time are: <br/>
<script type="text/javascript">pri nt_todays_date( );</script>
<script type="text/javascript">
w1 = window.open();
w1.document.wri te("Hello World");
</script>
</body>
</html>
------------------------------------------------------------------------------------------------------

Now in the above when i load the html page in FF 1.5 the date is
printed fine.
Also, a new window is opened with the text "Hello World", but the
window
cursor for the new window shows the the document is not loaded
completely.
Also, there's a partial blue bar at the bottom right of the new window
indicating
the page is not loaded completely.

I'd appreciate if anyone can point to the problem as to why the new
window
does not finish loading completely ?

Thanks a lot in advance.

Yashesh Bhatia

Jan 16 '07 #1
5 2269
ASM
Yashesh Bhatia a écrit :
Also, a new window is opened with the text "Hello World", but the
window
cursor for the new window shows the the document is not loaded
completely.
<script type="text/javascript">
w1 = window.open();
w1.document.ope n();
w1.document.wri te("Hello World");
w1.document.clo se(); // stops navigator waiting more loading
</script>

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 16 '07 #2
dd
You're missing a document.close( );

Jan 16 '07 #3
Lee
Yashesh Bhatia said:

If you open it, close it.
Also note that there's no guarantee that a new window will
have a document object to write into so soon after the open()
call:
>------------------------------------------------------------------------------------------------------
<html>
<head>
<title>Today' s Date</title>
<script type="text/javascript">
function print_todays_da te() {
var d = new Date(); // get today's date.
document.write( d.toLocaleStrin g());
}
</script>
</head>
<body>
The date and time are: <br/>
<script type="text/javascript">pri nt_todays_date( );</script>
<script type="text/javascript">
w1 = window.open();
w1.document.wri te("Hello World");
w1.document.clo se();
</script>
</body>
</html>
-

--

Jan 16 '07 #4
Lee said the following on 1/16/2007 10:12 AM:
Yashesh Bhatia said:

If you open it, close it.
Also note that there's no guarantee that a new window will
have a document object to write into so soon after the open()
call:
Along with:

There is no guarantee that a call to window.open that is not user
initiated (as in this instance) will even result in a new window.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 16 '07 #5
dd

Randy Webb wrote:
There is no guarantee that a call to window.open that is not user
initiated (as in this instance) will even result in a new window.
I see this sooooo many times out in the wild. People get a
handle to a new popup and don't check whether it exists
before trying to use it. It's one of the downfalls of always
having IE set to show the debug dialog.

Popup blockers people - get used to them.

Jan 17 '07 #6

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

Similar topics

44
4748
by: Carlos Andr?s | last post by:
Hi everybody. I've got a problem. I'd like to avoid opening a new window when you have pressed the shift key and you click in the left button of the mouse. I've tried the next solution, in the body of the page I put the next code: <BODY onkeydown='notOpenNewWindow();'>
9
1558
by: Karel | last post by:
All, I am completely new to Javascript but I have read some articles and examples about opening new windows from a webpage. However I am trying to open a data file ( in html format) that is not in the server dircetories but somewhere on my unix box. What I have sofar is:
5
6955
by: GEL | last post by:
Hi, I want to open a new browser window, let the user use that window for several minutes, and when they close, I'd like to change the page displayed in the original window. According to numerous articles found Googling, this should work, but on my WinXP system, using Firefox and IE, I get nothing (when allowing pop-ups, if pop-ups are disabled, IE reports the window is closed, Firefox gives a JS error on checking the window handle). No...
29
5035
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the window properly but does not pass the parameter. (this is part of a coldfusion template) <a href="##"
2
1792
by: Keshav Gadia | last post by:
Hi, I am an ASP.net newbie. I am writing a user control that is made up of datagrid with one of the columns opening a new window to display some details on click of the set image. I have basically used ImageButton server control. The problem is because I have used a server control with runat="server",the parent page is posted back and even though the window opens up,the focus gets set to the parent window. What I want is,the new window...
22
130476
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the document and closes it with the following code: <body onload="window.print(); window.close();"> This works correctly (or at least the way I expect it to work under MS Internet Explorer, but it cuases Netscape to "crash"
5
2165
by: Roger Withnell | last post by:
This is a framed webpage with the navigation bar in "NavBar" and the main window in "Main". When opening a new page in "Main" from "NavBar" with: function OpenFrameWindow(src) { var NewWindow = window.open(src, "Main"); NewWindow.focus(); }
44
9461
by: Viken Karaguesian | last post by:
Hello all, On occasion I want to open hyperlinks (images, etc.) in a new window. In the past, I've used target="_blank" to open the link in a new window. However, using the "target" attribute causes my pages to fail validation (strict doctype). The validator says "There is no attribute 'target'.." So...how do I open a link in a new window, without Javscript, and pass strict validation?
1
6323
by: OtisUsenet | last post by:
Hello, I have some onClick events in <a href...> elements, so they get called when a user clicks on a link. This works well, and looks like this: <a onclick="onLinkClick(123);" href="......">foo</a> Unfortunately, if a user opens the link in a new tab (e.g right click->open in new tab), my onLinkClick function does NOT get called.
0
10604
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10354
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...
1
10359
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10101
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
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
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3005
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.