How to close just opened tab?

Add-in Express™ Support Service
That's what is more important than anything else

How to close just opened tab?
 
Konrad Gorski


Guest


Hi Team,

I can't find how to close just opened browser tab.
I use method Navigate2 to open new tab.
In event DocumentComplete I want to close it.
How to?

Regards
Konrad
Posted 18 Sep, 2012 10:56:33 Top
Eugene Astafiev


Guest


Hi Konrad,

Did you try to use the http://msdn.microsoft.com/en-us/library/aa752140%28v=vs.85%29.aspx method of the WebBrowser class?

The following code works like a charm on my PC:

private void IEModule_DocumentComplete(object pDisp, string url)
{
   IEApp.Quit();
}


Is it what you are looking for?
Posted 18 Sep, 2012 12:27:11 Top
Konrad Gorski


Guest


Hi Eugene,

No, it closes browser, all tabs.
To close one tab I used simple solution (not elegant at first look), injected java-script:
page.parentWindow .execScript("window .open('', '_self', '');  window .close();");

and it works.

Regards
Konrad
Posted 19 Sep, 2012 05:32:21 Top
Eugene Astafiev


Guest


Hi Konrad,

Thank you for keeping us informed. I am glad to know that you have found the appropriate solution.

Good luck with your add-on project! :-)
Posted 19 Sep, 2012 05:55:05 Top