I don't know if there is a built in function in SharePoint for detecting it, like a callback or something. But you could maybe do it with DOMNodeRemoved
PS: Browser support for that event im not sure about, you'll have to check that out if users have older browser.
function AddNotification() {
var notifyId = SP.UI.Notify.addNotification("Message", false);
$(document).bind("DOMNodeRemoved", function(e)
{
if(e.target.id == notifyId)
{
// Add redirect script here
alert("Removed: " + e.target.id);
}
});
}
AddNotification();
I'm not sure what you mean abut JSOM redirect, because in the end its the same it does as location.href more or less. But there is a built in "redirect" function:
SP.Utilities.HttpUtility.navigateTo
It usese the STSNavigate
function from sp.core.js:
function STSNavigate(Url)
{ULSxSy:;
if (window.location.search.indexOf("IsDlg=1") !=-1)
{
if (Url.indexOf("?") !=-1)
{
if (Url.match("&$") !="&")
{
Url=Url+"&IsDlg=1";
}
else
{
Url=Url+"IsDlg=1";
}
}
else
{
Url=Url+"?IsDlg=1";
}
}
if (isPortalTemplatePage(Url))
window.top.location=STSPageUrlValidation(Url);
else
window.location=STSPageUrlValidation(Url);
}
As you can see, its just does some checks, and then set window.location