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




Posts: 6
Joined: 2012-07-23
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


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Konrad,

Did you try to use the Quit 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?
.NET, Extended MAPI, Windows Phone & RT
Posted 18 Sep, 2012 12:27:11 Top
Konrad Gorski




Posts: 6
Joined: 2012-07-23
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


Add-in Express team


Posts: 8540
Joined: 2007-07-25
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! :-)
.NET, Extended MAPI, Windows Phone & RT
Posted 19 Sep, 2012 05:55:05 Top