I'm having a curious problem. I open a window with window.open method
and supply a url which is a local file of file:/// form. After that, I
go into the document of this new window to read the DOM for multiple
forms which are defined in the html. The problem is that the objects are
not immediately there. To make them available, I've found that if I do a
View, Source from the new window's menu bar, THEN the DOM forms are
there as expected.
I'm using Mozilla 1.7.3; maybe it's my browser version. Problem with
using Firefox for me, the access to local content is limited. I tried
the change to the configuration that is supposed to allow this, but it
didn't work. 2 1459
John Derry wrote:
I'm having a curious problem. I open a window with window.open method
and supply a url which is a local file of file:/// form. After that, I
go into the document of this new window to read the DOM for multiple
forms which are defined in the html. The problem is that the objects are
not immediately there. To make them available, I've found that if I do a
View, Source from the new window's menu bar, THEN the DOM forms are
there as expected.
You may be trying to read the document before it's finished loading.
Some suggestions:
1. Have the new document set a variable onload. Use setTimeout to
check for the variable every 200ms or so until it's available, then do
stuff. Set a limit on the number of re-tries.
2. Have a function in the new page run onload to call the function in
the parent page that does stuff.
3. Guess at how long it will take to load the new page and use
setTimeout to wait that long before starting to process it. Check that
elements exist before trying to do anything with them.
Option 1 is OK, 2 is reasonably elegant, 3. is pretty awful.
--
Rob
RobG wrote:
John Derry wrote:
>>I'm having a curious problem. I open a window with window.open method and supply a url which is a local file of file:/// form. After that, I go into the document of this new window to read the DOM for multiple forms which are defined in the html. The problem is that the objects are not immediately there. To make them available, I've found that if I do a View, Source from the new window's menu bar, THEN the DOM forms are there as expected.
You may be trying to read the document before it's finished loading.
Some suggestions:
1. Have the new document set a variable onload. Use setTimeout to
check for the variable every 200ms or so until it's available, then do
stuff. Set a limit on the number of re-tries.
2. Have a function in the new page run onload to call the function in
the parent page that does stuff.
3. Guess at how long it will take to load the new page and use
setTimeout to wait that long before starting to process it. Check that
elements exist before trying to do anything with them.
Option 1 is OK, 2 is reasonably elegant, 3. is pretty awful.
You are absolutely right. While I'm waiting for the browser to get the
window open, my script has plowed ahead. I can loop until I see the flag
that I set, in onLoad event handler associated with the window, but
that is too long and the browser complains my script is taking too long.
Thanks alot for the help,
John This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ian Sedwell |
last post by:
Hi guys
The following code works just fine in Netscape on MacOS and Windows. But in
Explorer on MacOS and Windows it throws a type mismatch error at the point
marked with the comment ³// bug out at this point². (The functions that are
called, but not listed here work fine in both Netscape and Explorer in this
and other contexts, so I can confidently discount them as the source of any
error.)
I have also tried just a plain and simple...
|
by: Charles Law |
last post by:
For some reason, when I click the X to close my MDI parent form, the action
appears to be re-directed to one of the MDI child forms, and the parent
remains open. I am then unable to close the application.
What should happen, is that the main MDI form should close, taking the child
forms with it. There is code to loop through the child forms, remove the
controls on each of them, and then close the form, but this code should
execute only...
|
by: DOM_scripter |
last post by:
Hi, I want to set a picture on the fly. For this I have a html file
with only an <img> tag - kind of a placholder.
So I do myWindow=window.open("data/myFile.html"). Then I set the src
attribute of the img object to the image I ant to show. I thought I
could do this by myWindow.img.src but this does not work. Even
myWindow.img.src.URL gives me an undefined so I wonder, is DOM access
of an object I get via "window.open" possible at all?
|
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" runat="server"/>
<asp:Label ID="CompanyPicture" runat="server"/>
I have 2 links that open the windows to preview these images. The previewed
images are done on separate html pages that do nothing but display the
|
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,...
| |
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |