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
pra.ax1478pra.ax1478 

Popup to display on Custom VF page is closed

Hello,

 

I am trying to add a logic to have the pop up dispalyed on the custom VF when it closes. I came to know that the popup display when the CF page is closed is out of box solution in salesforce.

 

I tried using the Java script onclick event with no luck & kind of lost. Can anyone who came across such requirement help me.

 

Thanks.

S91084S91084

Have you tried the below code?

 

 function doUnload()
{
 if (window.event.clientX < 0 && window.event.clientY < 0)
 {
   alert("Window is closing...");
 }
}
...
<body onunload="doUnload()">

 

 

I found it online in one fo the forums.

pra.ax1478pra.ax1478

Hi S91084,

 

thanks for the reply. I tried the below but No Luck :( .

 

My exact logic is when people/user edit the VF page it opens up VF page in Edit mode (Which is Custom VF page). And the functionality to be added is when user click the 'X'  (Not close button in the browser window...in this case close the Account/Opportunity Custom VF page) it should pop up saying "save something".

 

 

 

 

pra.ax1478pra.ax1478

This is woking for the command button & IE/mozilla browser close to display the pop up. I am mainly looking for the pop up to display when I close the custom VF page tab. Using firebug, I figured out that it uses an anchor tag which has the class name & Id (ID is randomly generated) as attributes. Can you please let me know how do i map it in my custom page javascript to cal it. It is weird that the anchor tag doesnt have href or Id (as common name) to call.