3
votes

I'm trying to create a popup window that displays the browser toolbar and allows the URL to be edited just like a normal browser window. This is for a link in the backend of a custom CMS to enable the user to view a mobile formatted website. I understand that the default behavior for window.open() is toolbar=yes, location=yes and menubar=yes, however when using Chrome I'm getting a popup has a URL field that can't be edited and does not have the back, forward, reload buttons regardless of settings I use. Works fine in Firefox and Safari.

Here's the code I'm using:

<script>
function popupwindow(url, title, w, h) {
  var left = (screen.width/2)-(w/2);
  var top = (screen.height/2)-(h/2);
  return window.open(url, title, 'toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
} 
</script>
<a href="/?format=mobile" onclick="popupwindow('/?format=mobile', 'Mobile App', 336, 480); return false;">
    Launch App
</a>
1

1 Answers

1
votes

Chrome only supports a small set of window features when using window.open despite no of arguments you add (resizable=yes,scrollbars=yes,toolbar=yes, menubar=no,location=no,directories=no, status=yes) it always ignore these parameters.