Bug 78365 - window.opener.location can't be set in beforeunload handler
Summary: window.opener.location can't be set in beforeunload handler
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2012-02-10 10:56 PST by Sreeram Ramachandran
Modified: 2012-02-12 22:58 PST (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Sreeram Ramachandran 2012-02-10 10:56:38 PST
Setting the window.opener.location object (or its href property) doesn't work when performed inside an onbeforeunload event handler. Calling opener.location.reload() works, as does inspecting opener.location or opener.location.href. Setting the object or its href property works during normal page action (i.e., non-page-dismissal event) as well as during the onunload event. It's just during beforeunload that setting doesn't work.

Here's a simple test case:

<!-- main.html -->
<a href="#" onclick="window.open('popup.html')">popup</a>

<!-- popup.html -->
<script>onbeforeunload = function() { opener.location += "?foo" }</script>