function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Uday KUday K 

IFrame Issue

I am using iframe and giving vf page in that.In the vf page when when i am clicking to the save button it is going to the another page.but is calling the reference page in the i frame.How can i close the window which is containing the iframe and the open the referenced page in new tab.

 

<apex:page >

    <apex:form >
         <apex:commandButton value="Close" onclick="window.top.close()"/>
    </apex:form>

</apex:page>

 

Thanks,

Uday

Best Answer chosen by Admin (Salesforce Developers) 
Saravanan @CreationSaravanan @Creation

Hai Uday,

 

try to use this blow value on the onclick attributre

               onclick="window.close();"

 

And also try using instead 'onclick' to 'oncompleate' attribute with same above value.

 

 

All Answers

harsha__charsha__c

Hi Uday,

 

First open the new window you want to open with followed syntax

 

window.open('page reference','_blank');

 After opening your required window close the iframe window by "window.close();"

 

So finally onclick you need to code as followed.

 

window.open('page reference','_blank');
window.close();

 

Give a try on this, let me know in case of any concerns you face.

Saravanan @CreationSaravanan @Creation

Hai Uday,

 

try to use this blow value on the onclick attributre

               onclick="window.close();"

 

And also try using instead 'onclick' to 'oncompleate' attribute with same above value.

 

 

This was selected as the best answer
Uday KUday K

Thanks everybody. its working with the following code.

 

onclick="window.open('http://www.crowdchronicles.com/thank-you','_blank');window.parent.close();"  oncomplete="window.close()". 

 

But i want the window to be closed after 5 min. can someone suggest.

 

Thanks,

Uday