cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to close the iView when calling window.close()

Former Member
0 Kudos

Dear All,

I tried to close the iView when user clicks the "exit" button on my WD program.

Below is how I achieve...

1. In your component's interface view, create an exit plug. Name it as - ExitPlug.It's type 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 onUnload="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. in the view with IFrame UI element, wdDoInit(), use WDURLGenerator.getAbsoluteWebResourceURL to get the Static.html

Now,<b> the problem is that the Static.html page is successfully shown when user clicks the "exit" button, but Static.html page stays there without being closed.</b>

What I may do wrongly in my javascript??

I tried couple of combindations, but none of them is working

parent.close()

parent.parent.close()

thanks for any input.

Zita

View Entire Topic
suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Zita,

Try this once in javascript:

var currWindow = window.top;

currWindow.opener = window.top;

currWindow.close();

Regards, Suresh KB

Former Member
0 Kudos

Hi Suresh KB,

Thank you for your solution. I give it a shot but it still does not work though...

I give some alert message in this javascript function and the message is displayed correctly but window still opens.

Zita

Former Member
0 Kudos

By the way, I do not use the Exit plug...because it can not allow me to call an URL in portal....I create a view with IFrame UI element and its source is bound to Static.html page. I use regular outbound plug to call this view.