Re: Hosting WebBrowser control, NewWindow3, and window.opener problems

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
>


.



Relevant Pages

  • comp.lang.javascript FAQ - Quick Answers 2008-10-13
    ... Javascript Tips ... _How can I disable the back button in a web browser_? ... _How do I check to see if a child window is open, ... upon the cache headers that your server sends. ...
    (comp.lang.javascript)
  • Re: javascript:OpenChildWindow
    ... or on the MSN username) nothing happens. ... I right click on the image and select to open in a new window ... browsers and they break useful browser GUI ... when you click on a javascript pseudo-protocol link ...
    (comp.lang.javascript)
  • Re: Problem with Scripts
    ... This is browser issue not an XP issue. ... I am a Verizon user w/no noted problem using VoL Webmail on IE and FireFox. ... "Enable JavaScript box is checked. ... past the login window. ...
    (microsoft.public.windowsxp.general)
  • Re: Clear all optgroups and options from a select list
    ... could not drag one window over the contents of another because the mouse ... responsive in either major browser. ... As far as the javascript ... specification is concerned the implementations that assert that they ...
    (comp.lang.javascript)
  • Re: NewWindow2 handling example
    ... invisible window hosting a WebBrowser ... this temporary browser will be ... > information to cancel the navigation, ... could you please post here the value of the NewWindow3 event? ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)