简体   繁体   中英

JavaScript code working only in Debugger CRM 2011

I have the following line of code to refresh the parent form OnClose of Child form:

var popup = window.open(url, 'New Note', 'width=700,height=700');
 popup.focus();

Problem at below line

 popup.onbeforeunload = RefreshGrid; 

If I attach a breakpoint at above line using Developer Tools in IE-11 then alert is displayed and SomeWork is done: If I remove break-point then alert is not displayed and SomWork in not done.

function RefreshGrid() {    
alert("refresh grid");
SomeWork();
}

I have tried alot of different methods but all have the same problem, runs with Break-point and does not run without break-point.

Try to bind to onbeforeunload inside the pop up window. from the onbeforeunload event handler go to opener.RefreshGrid or opener.SomeWork

EDIT: This might be a cross domain issue. Consider putting the external URL in an IFRAME inside a controllable popup window ie in the same domain of your CRM app.

If you're browsing with IE you might also consider changing zone security setting for this specific website.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM