+ Start a Discussion

how to close child VF page shown as popup when parent is closed.



not able to close the pop-up window when parent is closed in chrome.


i added a custom section on Accounts tab in Salesforce which is displayed below Account Detail section.

The custom section and pop-up both are VF pages.


In this custom section after clicking on a button a pop-up window is displayed. what i want to do is, when someone closes the parent page i.e. the Accounts tab the child pop-up should get closed.


tried using showModalDialog but it is not working in chrome (in chrome the parent is still accessible if we use showmodalDialog to open a pop-up).


is there a way we can apply javascript on Accounts tab's onunload or onbeforeunload events, so that we can close the child window.


really stuck into this issue, Please help.




I don't think you can do this from just a custom section (on inline Visualforce page) on the main Account page. My suggestion would be to create a completely custom Visualforce page that handles the Account object, with standardController="Account" and extensions="YourCustomClass". Then from that Visualforce page you could control everything. Use the apex:detail component to show all the standard Account page fields and then use the apex:relatedList component to show all the related lists that you normally see on your account page.


The downside to this approach is not just the initial development time, but that an administrator can't change the look and feel of the page moving forward. It would all have to be maintained in code.


But otherwise, I'm not sure if it's possible to hook the native Account tab/page and insert your own close down procedures when the user closes the browser. 


Good luck!




Thanks for the response.


however i have to use the custom section in Accounts tab itself.

Is there any way we can open a modal popup in chrome, as i posted earlier that showmodalDialog is not working properly..and with jquery i'm not able to find a solution where we  can open VF page as popup from another VF page.