Methods to get a reference to a child window

S

SteveKlett

I'm using a on-demand, SaS ERp application. I would like to customize
a few aspects of the application and I can as they have the ability to
"deploy" custom scripts with the served up pages.

One of the things that the page does it open a popup child window. I
can't directly hook into this process and get a reference to the
popped window, but I need to.

Are there any techniques to detect when a window opens another window?

It looks like the Window object doesn't have a collection of child
Windows, so I can't check that.. I really don't know what other
options there are.

I found one thread on google that covers this question and the answer
was "no" but it was pretty old thread, maybe something has changed?

In a nutshell, I need to detect when a new window opens up. Is that
possible and if so... can you give me some hints how it's
accomplished?

Thanks,
Steve
 
J

Joost Diepenmaat

In a nutshell, I need to detect when a new window opens up. Is that
possible and if so... can you give me some hints how it's
accomplished?

*if* the script opens a new window using window.open(), you *might* be
able to replace that method with something of your liking:

var oldopen = window.open;
function open() {
var win = oldopen.apply(window,arguments);
// do something here
return win; // return to calling code
}

This is completely untested and unresearched code.
 
J

Joost Diepenmaat

Joost Diepenmaat said:
*if* the script opens a new window using window.open(), you *might* be
able to replace that method with something of your liking:

var oldopen = window.open;
function open() {

That may have to be:

var oldopen = window.open;
window.open = function () {

To prevent the function declaration from running earlier than the var
oldopen assignment. Again, untested...
 
S

SteveKlett

That may have to be:

var oldopen = window.open;
window.open = function () {

To prevent the function declaration from running earlier than the var
oldopen assignment. Again, untested...

--

So I would basically be hijacking the built in method, I like it! ;0)

Thanks for the suggestion, I will check this out.
 
J

Joost Diepenmaat

So I would basically be hijacking the built in method, I like it! ;0)

Thanks for the suggestion, I will check this out.

It should work, the main issue is that AFAIK browsers *may* make those
methods read-only. I'd be interested to know if it works on the usual
systems :)
 
T

Thomas 'PointedEars' Lahn

Joost said:
It should work,

Not at all. The object referred to left-hand side of the assignment
expression is a host object. You can expect anything from "nothing
happens" to "runtime error".
the main issue is that AFAIK browsers *may* make those methods read-only.

IOW, the host object may implement its own [[Put]] method.
I'd be interested to know if it works on the usual systems :)

I wouldn't.


PointedEars
 
L

Laurent vilday

Thomas 'PointedEars' Lahn a écrit :
I wouldn't.

Do you really think anyone care about what you are or not interested ?

Please get real and go consult a psychiatrist while you are at it !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top