Skatterbrainz
Skatterbrainz

Reputation: 1087

JavaScript window.open() method in Google Chrome doesn't respect resizable option

Does Google Chrome 25.x not respect the "resizable" option in the window.open() method parameters list. The following code works fine in IE9 and IE10, by not allowing the user to resize the window, but in Chrome 25.0.x it still allows me to resize the window. I've tried resizable=0 but it makes no difference.

<!DOCTYPE html>
<html>
<head>
<script>
function openWin()
{
myWindow=window.open('','','width=300,height=200,resizable=no');
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.focus();
}
</script>
</head>
<body>

<input type="button" value="Open window" onclick="openWin()" />

</body>
</html>

Is there a workaround for this?

Upvotes: 2

Views: 5954

Answers (1)

epascarello
epascarello

Reputation: 207537

Basiclaly they have disabled it because it is for accessibility.

From MDN docs

Window functionality features

resizable

If this feature is on, the new secondary window will be resizable. Note: Starting with version 1.4, Mozilla-based browsers have a window resizing grippy at the right end of the status bar, this ensures that users can resize the browser window even if the web author requested this secondary window to be non-resizable. In such case, the maximize/restore icon in the window's titlebar will be disabled and the window's borders won't allow resizing but the window will still be resizable via that grippy in the status bar. Starting with Firefox 3, secondary windows are always resizable (bug 177838)

Tip: For accessibility reasons, it is strongly recommended to set this feature always on Mozilla and Firefox users can force new windows to be easily resizable by setting dom.disable_window_open_feature.resizable to true in about:config or in their user.js file.

Upvotes: 3

Related Questions