Re: Hosting WebBrowser control, NewWindow3, and window.opener problems
- From: "Rob Parsons" <iecustomizer@xxxxxxxxxxx>
- Date: Sat, 6 Aug 2005 16:07:16 +1000
This is a hard one to answer. All the searching I have done has not turned
up a definitive answer. Seems that window.opener is a javascript thing
However I did find this interesting snippet..
window.opener.location = url
which seems to suggest that you could program the child window opener not by
a hwnd but by the location url of the parent. ie either by
using mshtml.dll to set the window.opener.location value to the url address
of the parent window ( I am not sure if mshtml exposes the opener but it
would seem logical that it would)
or
on creating the new window insert a snippet of code in the document say
beforeBegin that does the javascript assignment above.
I haven't done it but I would suggest that in your project you make a
reference to mshtml and the search the Object Browser for the opener objects
properties.
I see also that you refer to the 'NewWindow3' event... Is this a typo? or
did you mean NewWindow2 event... I am using Win2000 and v6 sp3 IE... If
there is a NewWindow3 event then it is probably only for the XP versions of
IE.. so becareful if you want to deploy to other platforms.
I just opened mshtml in an object browser and yep the opener object is
referenced as a property of a HTMLWindow2 object.
As a parting thought, you might like to try when you create the new window
to set its Parent property to the hwnd of the browser ctrl that is creating
it? Maybe somehow that will set the opener property in the child browser?
Good luck... don't know. Might be back to the old drawing board.
"Neil" <Neil@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0A27FABE-0357-40A1-9D84-34BC6804F8A6@xxxxxxxxxxxxxxxx
> Greetings,
>
> Forgive me if this is in the wrong newsgroup...
>
> I have a C# app that has a form that hosts the IE WebBrowser control. I've
> added an event handler for the NewWindow3 event so that when a new window
is
> requested, I can created my own form with the browser control and display
the
> requested URL.
>
> The problem is that new HTML has javascript code that uses window.opener.
In
> standalone IE, this works fine. But under my application, nothing happens.
I
> need this to happen in my app.
>
> Does anyone know how to associate a new browser control to a an existing
one
> (opener-child)?
>
>
> I have code, sample html, that I can post up here if anyone needs more
info.
>
> Tia...
>
>
> Neil
>
.
- Follow-Ups:
- References:
- Prev by Date: Re: Why can't I change security settings? IE6sp2
- Next by Date: Re: Why can't I change security settings? IE6sp2
- Previous by thread: Hosting WebBrowser control, NewWindow3, and window.opener problems
- Next by thread: Re: Hosting WebBrowser control, NewWindow3, and window.opener prob
- Index(es):
Relevant Pages
|