Unable to set location property of object returned by window.open
Reported by
dahje...@gmail.com,
Feb 15 2017
|
||||||
Issue descriptionSteps to reproduce the problem: 1. Go to https://output.jsbin.com/naweva. (Or run attached HTML file.) 2. Click the "Click!" button. 3. Observe the opened tab/window. What is the expected behavior? I expected https://www.google.com/#q=success to open in the new tab. What went wrong? https://www.google.com/#q=failure opened instead. Did this work before? No Does this work in other browsers? Yes Chrome version: 56.0.2924.79 Channel: stable OS Version: 9.3.5 Flash Version: This works in all desktop browsers I've tried, Chrome for Android, Safari for iOS, but not in Brave, Chrome, or Firefox for iOS.
,
Feb 16 2017
,
Feb 16 2017
,
Feb 16 2017
If it's helpful, here's a Firefox for iOS bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1339912
,
Feb 16 2017
Thanks! It is helpful. It means that bug is more-likely WKWebView specific and the only thing we can do is to file a radar. Not reproducible with Mobile Safari though.
,
May 10 2017
,
Jul 12 2017
,
Sep 29 2017
This indeed looks like a WKWebView issue because iOS Safari behaves the same as Chrome.
However, maybe the behavior is legitimate. According to MDN article on Window.open, "The returned Window reference can be used to access properties and methods of the new window as long as it complies with Same-origin policy security requirements.". The example in #1 opens a window that's from a different origin.
I created a different example where the opened page is from the same origin (see below). Then setting location property on object returned by window.open works in both Safari and Chrome on iOS.
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<script>
window.onload = function() {
document.getElementById("click").addEventListener("click", function() {
console.log("clicked!");
var w = window.open("1.html?query=fail");
setTimeout(function() {
w.location = "1.html?query=pass";
}, 0);
});
};
</script>
</head>
<body>
<button id="click">Click!</button>
</body>
</html>
I'll mark this as Wont Fix now.
,
Sep 30 2017
If the behavior differs, this is an interoperability and perhaps a compatibility issue. Please, report this to Apple instead and re-open it. If you WontFix this, you should strive to change the behavior of the rest of the browsers.Otherwise, it should be marked as ExternalDependency and reported to Apple. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by justincohen@chromium.org
, Feb 15 2017