cancel
Showing results for 
Search instead for 
Did you mean: 

Closing Browser Window

Former Member
0 Kudos

Hi All,

I am using NW 2004s SP10 server. I want to close the browser window by clicking on a "Close Button". By going through other threads

I am using the below code in my Web Dyn Pro view.

String Url = WDURLGenerator.getWebResourceURL(wdComponentAPI.getDeployableObjectPart(),"exit.html");

if(!WDPortalUtils.isRunningInPortal()){
wdThis.wdGetSampleWindowInterfaceViewController().wdFirePlugClose(Url);
}else
{
WDPortalNavigation.navigateAbsolute(
		Url,
		WDPortalNavigationMode.SHOW_INPLACE,
		(String) null,
		(String) null,
		WDPortalNavigationHistoryMode.NO_DUPLICATIONS,
		(String) null,
		(String) null,
		(String) null,
		 true); 
}

exit.html

<html>
<head>
<script langauage="javascript">
function closeWindow()
{
var currWindow = window.top;
currWindow.opener = window.top;
currWindow.close();
}
</script>
</head>
<body onload="javascript:closeWindow()">
</body>
</html>

Its working fine when I run the the application as Standalone. But when I run this on Portal, Its not working. I think problem is with

WDPortalNavigation.navigateAbsolute() method. Any good suggestions will be rewarded.

Thank you,

Sreekanth

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

The <i>navigateAbsolute</i> method expects a PCD path of an iview as the URL, not anything else. So your passing the resource URL will not work.

You'll have to create an URL iview, maintain the resource URL as the URL property of this iview and then pass the PCD path to the <i>navigateAbsolute</i> method. Your code should look like:

WDPortalNavigation.navigateAbsolute(
		"ROLES://<pcd path to the URL iview>",
                                 .......):

Regards,

Satyajit.

Former Member
0 Kudos

Hi Satyajit,

Thanks for your response. I will try this. But instead of this, is there any other simple way to achieve this(closing browser window).

Thanks,

Joe

Former Member
0 Kudos

Hi All,

Is there any way to call exit.html file other than these 2:

wdFirePlug(Url)--It is not working in portal on 2004s server,

WDPortalNavigation.navigateAbsolute()--I can't pass resource URL to this.

Thanks

Joe

Answers (2)

Answers (2)

Former Member
0 Kudos

HI

<b>METHOD 1</b>

1) In your Interface view, create an exit plug with a parameter Url of type string.

2) Add your Interface view controller to your current view's required controller. (in properties tab of your view)

3) After opening the new External window fire the outbound plug as :

wdThis.wdGet<your interface view controller>().wdFirePlug<your exit plug's name>("javascript:void(window.close())");

<b>METHOD 2</b>

1)WDClientUser.forceLogoffClientUser(<i>url</i>);

(<i>url</i> here cane be blank html page which closes itself <i>onLoad</i> or any other webpage you want )

for eg. WDClientUser.forceLogoffClientUser(close.html);

or WDClientUser.forceLogoffClientUser(www.sn.sap.com); etc

Former Member
0 Kudos

Hi Virag,

If you see my post I am using Method 1 only. This is not working(FirePlug in portal) in 2004s. I already tried Method 2 also, but failed.

Thanks

Joe

Former Member
0 Kudos

Hi,

I also faced the same problem.

In my requirement i was trying to open the generated URL in the same window but inspite of SHOW_INPLACE mode my window was being opened in a new browser window.

Try giving google.com as url ..see if it opens in a new window. Could be a bug. Plzz do correct me if i am wrong!

-Veena.