In Firefox the window is not re-sizeing using JavaScript, - javascript

I have a JavaScript to re-size all my popup windows:
function resize()
{
window.resizeTo(240,230);
}
But now it is not resizing in Mozilla Firefox, but it was doing earlier, also
or if the popup window is opened in a new tab, it is not resizing, also in some browsers it is not also. Is there any piece of JavaScript code which works in all scenarios and all browsers?

Firefox comes with a preference for user to allow/disallow resizing of
window using Javascript. It's in Tools - Options - Content - Enable
Javascript -> [Advanced].
I am not sure if resizing is disabled by default, but you might want
to check your own Firefox installation first.
If it's disabled by default, then unfortunately there is nothing you
could do to resize the window after it has been opened. An ugly
workaround would be to open itself once again using window.open() with
the preferred size though.
Source: timdream (here)
I'll also add that:
You can't be assured that any browser will let you control the size of
windows you create. You can't even be sure you'll get a window at all
- people can instruct their browsers to open all new windows as browser tabs
Source: Pointy (same source as timdream)

Related

Window.open doesn't work when original window size is specified

I have a script that opens a chrome window like so chrome.exe --user-data-dir="%LOCALAPPDATA%\Google\Chrome\User Data\" --window-size=1280,118 --window-position=0,0 --app="file:///C:/desktop/test.html" I need to open another smaller popup window from that window but the popup always opens in the same size as its parent (1280x118). I have tested using window.open('','','resizeable, width=100,height=200') from a regular chrome window and it works as expected. It seems that window.open does not respect the width and height specified if it is launched from a window with a specified window-size. Are there any alternatives to window.open? Or does anybody know how to make this work in Chrome? Its working fine in IE but want to phase out IE for obvious reasons.
I made this work by setting window.open to a variable and then using window.resizeTo to change its size.
var myWindow=window.open('','newWin','width=200,height=100');
myWindow.resizeTo(200,300);
myWindow.moveTo(500, 100);
myWindow.focus(); ```

How to prevent firefox window manual resizing?

I use the last firefox release (45.02) on windows 7.
I want to prevent user to resize manually the windows. I have a non responsive GUI, and I want to fix the browser interface.
I can't use the javascript resizeTo(...) function because of MDN docs
You can't reasonably do this. Which is a Good Thing. The user is in control of their browser, not you.
You can control the size of a popup (including whether it can be resized), within reason, so temporarily while you sort out the responsive thing, you could provide users a link to open a window in the size you want:
Open window in XxY for best experience of this site.
then
document.getElementById("open-window").addEventListener("click", function() {
window.open("http://example.com", "", "width=640,height=480,resizable=no");
}, false);
Note that some browsers may still allow resizing, either in the normal way or via a small "grippy" (as the Firefox folks call it).

FF not setting size on window.open

I have a simple JS script including:
OpenWindow=window.open("", "newwin", "height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");
FF 21.0 opens it to the full size of the browser window.
Chrome and Opera correctly open it to the specified width and height.
Is this a known bug in FF? Is there some way around it?
You need to remove the space between height and width in your third argument.
See strWindowFeatures # MDN
Update:
As Pointy says, this doesn't seem to be the case (and from some testing it certainly doesn't affect me in FF 24). However, quoting from Firefox's tab preferences and settings page:
If you have chosen to open pages in new tabs, Firefox will ignore this option and will open a new window from a link if the page author specified that the new window should have a specific size, because some pages can only be displayed correctly at a specific size.
So this must have been changed from FF 21 til now. How are you triggering the window.open? I know some browsers differentiate based on event source, meaning you get different results on triggering it in Javascript vs. from a user-initiated event.
Voila! Pointy had the answer.
I hadn't noticed that the window was opening in a new tab.
I unchecked the browser open-in-a-new-tab option, and now I get the properly-sized window.
Thank You!

Javascript's `window.resizeTo` isn't working

I'm trying to create a bookmarklet to do some very specific resizing to do browser size testing, and I can't seem to get the web browser to resize using window.resizeTo.
Overly simplified example that doesn't work:
javascript:window.resizeTo(1024,600);
I can understand that browsers might have disabled this feature, but here's a screenshot of my JavaScript Settings in Firefox:
Am I missing something obvious or should I file a bug report?
According to this bug report, this is a new feature, not a bug. Specifically:
Two rules:
Can't resize a window/tab that hasn't been created by window.open.
Can't resize a tab if the tab is in a window with more than one tab.
If I understand this "fix" correctly, you can resize only your own popup windows, not the main window.

how can we disable resizing of new popup window in firefox?

I tried opening a new window using
window.open("lookup.htm","lookupWin", "height=400,width=500,resizable=false");
It works fine in IE, but in FF the pop up is still resizable. How can I disable this resizing in FF as well?
Read this one from mdc
Window functionality features
resizable
If this feature is set to yes, 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 - Make all popup windows resizable, ignoring resizable=no
Yes it doesn't work anymore. Try
<script type="text/javascript">
window.onresize = function()
{
window.resizeTo(500,500);
}
window.onclick = function()
{
window.resizeTo(500,500);
}
</script>
I don't think you can. Firefox (and some other browsers) just ignore the "resizable" setting.
you con configure dom.disable_window_open_feature.resizable to value false, in order to make window.open re sizable work.
Type about:config
Accept the warning
Search by typing resize and press enter ,
Look for dom.disable_window_open_feature.resizable
double click to change the value. false -> you can not resize the popup in firefox.

Categories