Reputation: 31
I've got a problem to handle the window.onbeforeunload
event in a JS-Application in a HTML-web resource for Microsoft Dynamics CRM 2011. By using the "normal" IE the following code works fine:
window.onbeforeunload = function (e) {
if (changedData) {
var message = 'leave...';
if (typeof e == 'undefined') {
e = document.parentWindow.event;
}
if (e) {
e.returnValue = message;
}
return message;
}
}
But in the CRM 2011 Outlook client, I don't get the leave message. Have you any idea to get a leave message when closing the window?
Upvotes: 2
Views: 2178
Reputation: 3878
The CRM "object stack" in Outlook versus IE is likely to be different (since if nothing else, Outlook container windows are involved to wrap the IE Iframes) so when you are using "undocumented" events (in the CRM SDK sense) then you will be susceptible to such "surprises" ;)
What do you expect to happen with your code? You are only setting a returnValue
on an event - this alone will not result in any user feedback.
Have you confirmed if your code is running at all (i.e. inserting an alert();
)?
Upvotes: 1