|
Rank: Newbie Groups: Member
Joined: 4/7/2017 Posts: 4
|
In build 17.1.14.0, we are having issues with the JavaScript events onbeforeunload and onunload getting called. We have web application developers who are expecting their popup to invoke a function on the window.opener in the onbeforeunload event handler, and it is not being invoked, both when the window is closed by the user (my application invokes the Close method during the window closing process) and when their main page invokes the window.close() function from javascript. Is this something that you've heard of from this build, or a problem that others have worked around before? I'd also like to add that the callback method for
is never being invoked, whether the window is closed via JavaScript or by the user. Thank you, Mike Sanderson
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, We are not able to reproduce either problem. Can you try to isolate the problem into a test project and then send the test project to us? See here for more details: https://www.essentialobjects.com/forum/test_project.aspxOnce we have the test project, we will be happy to investigate further. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 4/7/2017 Posts: 4
|
I've been able to refactor our code a bit and have found something interesting. It's not that onunload or onbeforeunload are not being invoked, but that we're getting cross-origin scripting issues between the popup and the parent window. The two web pages are located in the same directory, and are accessed via http (the parent calls window.open('page2.html', "Page Title")). Given that I am unable to reproduce this issue in the TabbedBrowser sample application, is there an advanced security setting that I may need to change?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
The cross script security is enabled by default. You can turn it off by setting this property to false: https://www.essentialobjects.com/doc/eo.webengine.browseroptions.enablewebsecurity.aspxIf you are not familiar with setting browser options, you can find more details here: https://www.essentialobjects.com/doc/webbrowser/advanced/browser_options.aspxHope this helps. Thanks
|
|
Rank: Newbie Groups: Member
Joined: 4/7/2017 Posts: 4
|
I have tried setting both EnableWebSecurity and EnableXSSAuditor to false (see code) and neither option has alleviated this issue.
Code: C#
Engine engine = Engine.Create(_engineName);
engine.Options.SetDefaultBrowserOptions(new BrowserOptions
{
EnableWebSecurity = false,
EnableXSSAuditor = false
});
I have confirmed that the popup WebView has the appropriate engine and browser options associated with it by inspecting the WebView in the new window event handler. Also, looking through the TabbedBrowser sample code, I cannot find anywhere that the BrowserOptions are being changed, and yet this process works in the TabbedBrowser but not in our implementation.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Can you send us a test project? Without being able to see the full code it would be pretty much shooting in the dark for us. The option you set is the correct option to turn off cross site security.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 4/7/2017 Posts: 4
|
I have submitted a sample application replicating the issue.
|
|