on 09-04-2006 7:57 PM
Hi,
I have a webdynpro application (developed in 2004s) where I have a close button. When user clicks close button, I simply need to close the browser.
I tried using javascript:void(window.close())" as exit plug parameter from interface view still throws me an exception com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Invalid URL=javascript:void(window.close())
Is there any way to close the main application window.
Thanks for your time and help.
Best Regards,
Shiva
This can close the Window from Controller, and no Logoff from portal issue.
It doesn't need to create any outbound plug.
1. Create a Close.html. and it under the
src\mimes\Components\<Component package>\close.html
<html>
<head>
<script langauage="javascript">
function closeWin(){
window.close();
}
</script>\
</head>
<body onload="javascript:closeWin();"> </body></html>
2. Use the following code.
try{
String Url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"close.html");
TaskBinder.getCurrentTask().getClient.sendRedirect(Url, 0);
}
catch (Exception e)
{
e.printStackTrace();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shiva,
Follow sridhar's reply above. it works as i mysself have tried it.
In your html use the following code.this code will not ask you before closing.
<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>
If you want you can have a confirmation dialog in your webdynpro application before closing the application main window.
Use the step 6 code in you appropriate action
need anything can reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shriram,
Here problem is not with the javascript coding. How to use this javascript code in webdynpro. I am going to mention the issues again.
If this javascript code is in exit.html file. we need to navigate to this file once we click the close button. To achieve that we need to
create a Resource Url using below code
WDURLGenerator.getWebResourceURL(wdComponentAPI.getDeployableObjectPart(),"exit.html") once we create that below are the issues:
1) In NW 2004s portal won't support FirePlugs with Url. We need to use WDPortalNavigation.navigateAbsolute() method for navigation.
2) In WDPortalNavigation.navigateAbsolute() we need to pass PCD Url. But here it is Resource url.
Then how can we navigate to html file.
Thanks
Sreekanth
HI
METHOD 1
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())");
METHOD 2
1)WDClientUser.forceLogoffClientUser(url);
(url here cane be blank html page which closes itself onLoad or any other webpage you want )
for eg. WDClientUser.forceLogoffClientUser(close.html);
or WDClientUser.forceLogoffClientUser(www.sn.sap.com); etc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shiva,
I also have similar req. Did you find any solution for this. If so please post that.
Thank you,
Sreekanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Have you tried creating a static html page with the javascript to close the window? Then you can fire an exit plug to this html page.
You can also try the following code:
//TaskBinder is of type com.sap.tc.webdynpro.services.task.TaskBinder
TaskBinder.getCurrentTask().getClient().sendRedirect("javascript:window.close();",0);
Here I would like to point out that, it looks to me that TaskBinder may not be a part of the standard WD API. So in later versions this may not be supported.
Regards,
Satyajit.
Hi,
Go thru the below steps. Here u need to create a html file to close the main window.
1. In your component's interface view, create an exit plug. Name it as - ExitPlug It types as "Exit".
2. Create a paramater for this exit plug. Name this parameter "Url". It should be exactly like the same name.
3. In your view add the interface view as a required controller.
4. Create your HTML file. Let's say you call it Static.html.
<html>
<head>
<script langauage="javascript">
function closeWin(){ window.close();
}
</script>
</head>
<body onload="javascript:closeWin();"> </body></html>
5. Save this in the mimes folder for your DC under your package. You do this from the navigator view.
6. Now use the following code:
try {String url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"Static.html");wdThis.wdGet<your component name>InterfaceViewController().wdFirePlugExitPlug(url);} catch (WDURLException e) {}
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.