473,432 Members | 1,386 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,432 software developers and data experts.

Using DOM to access other windows

All,

Is there any way to access a separate IE 6.0 browser process via the
Javascript DOM ? For example, open IE once. Open IE again (not using
File->New). Can the second IE browser/process access the DOM objects
of the first, if so, can someone please post a bit of sample code?

thanks.
-Jeff
Jul 20 '05 #1
6 7811
je******@hotmail.com (Jeff T.) writes:
Is there any way to access a separate IE 6.0 browser process via the
Javascript DOM ?


Not directly.
One thing to notice, is that different IE windows are all using the
same browser component, so they can theoretically communicate.

To access another window's properties, you need a reference to that
window. There is no direct way to find such a reference to an existing
window.

There is a (not so pretty) hack.
If you open a new window with a name, i.e.,
var w = window.open("","windowName");
in both browsers, then the second to call window.open will get a reference
to the window openend by the first.
If the first browser stores a reference to itself in the window, the
second can read it.

Try this:

In browser 1:
var w = window.open("","foobarbaz");
w.dummy = window;

In browser 2:
var w = window.open("","foobarbaz");
otherBrowser = w.dummy;
otherBrowser.otherBrowser = window;
w.close();

After this, both browser windows have a reference to the window object
of the other browser. Try it by, e.g., changing the background:

In browser 1:
otherBrowser.document.body.style.backgroundColor = "red";

In browser 2:
otherBrowser.document.body.style.backgroundColor = "green";

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
DU
Jeff T. wrote:
All,

Is there any way to access a separate IE 6.0 browser process via the
Javascript DOM ? For example, open IE once. Open IE again (not using
File->New). Can the second IE browser/process access the DOM objects
of the first,
No. It's possible only and only if the "second" browser window was
opened via javascript. Only in cases where the "second" window is a
sub-window (also referred as secondary window or child window) created
with the window.open() call.

if so, can someone please post a bit of sample code?
thanks.
-Jeff


Open a sub-window and dynamically DOM-insert an image:
http://www10.brinkster.com/doctorunc...geInPopup.html

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #3
Hello Lasse,

This worked wonders! Thank you for this piece of ingenious advice.

Regards,
-Jeff
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<is**********@hotpop.com>...
je******@hotmail.com (Jeff T.) writes:
Is there any way to access a separate IE 6.0 browser process via the
Javascript DOM ?


Not directly.
One thing to notice, is that different IE windows are all using the
same browser component, so they can theoretically communicate.

To access another window's properties, you need a reference to that
window. There is no direct way to find such a reference to an existing
window.

There is a (not so pretty) hack.
If you open a new window with a name, i.e.,
var w = window.open("","windowName");
in both browsers, then the second to call window.open will get a reference
to the window openend by the first.
If the first browser stores a reference to itself in the window, the
second can read it.

Try this:

In browser 1:
var w = window.open("","foobarbaz");
w.dummy = window;

In browser 2:
var w = window.open("","foobarbaz");
otherBrowser = w.dummy;
otherBrowser.otherBrowser = window;
w.close();

After this, both browser windows have a reference to the window object
of the other browser. Try it by, e.g., changing the background:

In browser 1:
otherBrowser.document.body.style.backgroundColor = "red";

In browser 2:
otherBrowser.document.body.style.backgroundColor = "green";

/L

Jul 20 '05 #4
Hi again,

The two pages talk perfectly if they're both local html files.
However, when I run Tomcat (a web server) on one of the pages, and the
other page is local, I'm getting permission denied on an attempt to
get the third dummy window.

The JavaScript error is as follows:
Error: Permission Denied
on the line:
otherBrowser = w.dummy;

Any advice? Thanks.
-Jeff
je******@hotmail.com (Jeff T.) wrote in message news:<1b**************************@posting.google. com>...
Hello Lasse,

This worked wonders! Thank you for this piece of ingenious advice.

Regards,
-Jeff
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<is**********@hotpop.com>...
je******@hotmail.com (Jeff T.) writes:
Is there any way to access a separate IE 6.0 browser process via the
Javascript DOM ?


Not directly.
One thing to notice, is that different IE windows are all using the
same browser component, so they can theoretically communicate.

To access another window's properties, you need a reference to that
window. There is no direct way to find such a reference to an existing
window.

There is a (not so pretty) hack.
If you open a new window with a name, i.e.,
var w = window.open("","windowName");
in both browsers, then the second to call window.open will get a reference
to the window openend by the first.
If the first browser stores a reference to itself in the window, the
second can read it.

Try this:

In browser 1:
var w = window.open("","foobarbaz");
w.dummy = window;

In browser 2:
var w = window.open("","foobarbaz");
otherBrowser = w.dummy;
otherBrowser.otherBrowser = window;
w.close();

After this, both browser windows have a reference to the window object
of the other browser. Try it by, e.g., changing the background:

In browser 1:
otherBrowser.document.body.style.backgroundColor = "red";

In browser 2:
otherBrowser.document.body.style.backgroundColor = "green";

/L

Jul 20 '05 #5
je******@hotmail.com (Jeff T.) writes:
The two pages talk perfectly if they're both local html files.
However, when I run Tomcat (a web server) on one of the pages, and the
other page is local, I'm getting permission denied on an attempt to
get the third dummy window.
Yes, the dummy window belongs to the domain of the page that opened it
until a page is loaded into it. Cross domain scripting restrictions apply.
Any advice?


If one of the pages are always local, and you are using Internet
Explorer, you can make it an HTA-file (HTML application, look it up on
MSDN). That gives it permission to ignore cross domain restrictions.
You will just have to make the other page open the window.

If you want to have it work generally, i.e., on other people's
browsers, across domains, then my advice is to give up. Any cross
domain scripting hole you find will be closed eventually, and
most people will not change their default security settings to
accomodate your page.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #6
I tried the HTA lead you gave me, and it proved successful, and
sufficient for my needs. Thank you very much, Lasse.

Regards,
-Jeff
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<4q**********@hotpop.com>...
je******@hotmail.com (Jeff T.) writes:
The two pages talk perfectly if they're both local html files.
However, when I run Tomcat (a web server) on one of the pages, and the
other page is local, I'm getting permission denied on an attempt to
get the third dummy window.


Yes, the dummy window belongs to the domain of the page that opened it
until a page is loaded into it. Cross domain scripting restrictions apply.
Any advice?


If one of the pages are always local, and you are using Internet
Explorer, you can make it an HTA-file (HTML application, look it up on
MSDN). That gives it permission to ignore cross domain restrictions.
You will just have to make the other page open the window.

If you want to have it work generally, i.e., on other people's
browsers, across domains, then my advice is to give up. Any cross
domain scripting hole you find will be closed eventually, and
most people will not change their default security settings to
accomodate your page.

/L

Jul 20 '05 #7

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

Similar topics

43
by: nospam | last post by:
I got three (3) files (1) Untitled.aspx (2) Untitled.aspx.1.cs (3) Untitled.aspx.2.cs These three files must be used together to make file #1, Untitled.aspx, page work via J.I.T. when the...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
9
by: Ben Dewey | last post by:
Project: ---------------------------- I am creating a HTTPS File Transfer App using ASP.NET and C#. I am utilizing ActiveDirectory and windows security to manage the permissions. Why reinvent...
2
by: YRao | last post by:
I am going to create intranet application using Windows Authentication using C# asp.net I am having following problem: 1 setting windows Authentication, it will validate for all users, user...
0
by: Tessa | last post by:
Is there any security reason why you cannot print to a network printer from ASP.NET under IIS6 on Windows 2003 server? I'm using ASP.NET code to print to a server print queue using...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
0
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
3
by: Jay-nospam | last post by:
Hi there, I am having trouble getting an ASP.NET web application to connect to another computer and passing the proper credentials and I hope someone can help me. I have a stand-alone Windows...
1
by: Screenbert | last post by:
After finding nothing anywhere in google I am posting this so everyone can benefit by it. The formating is not pretty since I copied it from my word document, but you should benefit by it. ...
0
by: screenbert | last post by:
Managing DHCP Servers using C# They said it was impossible. It couldn't be done. But you can in fact manage DHCP servers using C#. This includes creating and deleting Scopes, SuperScopes,...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.