New issue
Advanced search Search tips

Issue 692710 link

Starred by 4 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Sep 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 3
Type: Compat



Sign in to add a comment

Unable to set location property of object returned by window.open

Reported by dahje...@gmail.com, Feb 15 2017

Issue description

Steps 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.

 
Owner: eugene...@chromium.org
eugenebut@ can you take a look?
Labels: Needs-Triage-M56
Components: Mobile>WebView>Glue
Labels: -Needs-Triage-M56
Status: Assigned (was: Unconfirmed)

Comment 4 by dahje...@gmail.com, Feb 16 2017

If it's helpful, here's a Firefox for iOS bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1339912
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.
Cc: danyao@chromium.org
Labels: -Type-Bug -Pri-2 Pri-3 Type-Compat
Cc: eugene...@chromium.org
Owner: ----
Status: Available (was: Assigned)

Comment 8 by danyao@chromium.org, Sep 29 2017

Status: WontFix (was: Available)
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.

Comment 9 by phistuck@gmail.com, 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