1

I made a uploader that allows drag and drop but because people usually browse with their browsers taking up most of the screen I would like to make the browser smaller when a user clicks a button so its easier for him/her to drag the files in...

Is there a way to resize a browser window thats already open... or at least to minimize the browser in js??

I know there is window.resizeTo(w,h);

but it doesnt work for me

Update can users choose to unblock this functionality for a specific website?? and is there a way for me to check if a user allows or blocks that option?

Will i still be able to use window.resizeTo(w,h); is i make a new window pop up ?? Because if i am i will try defaulting to that.

If its possible to allow resizeTo(w,h); for a specific website (i mean by user settings or editing some files on the computer not by js even if it only works for some browsers ) how do you do that?? (even if its really difficult i would like to know)

Similar Question (with an answer how to do it in chrome): set_browser_window_size

Another One (this one explains how you can check about:config values with js) check about:config with js

It be nice to see a list of browsers that support the resizeTo function with the version number.

Community
  • 1
  • 1
Xitcod13
  • 5,949
  • 9
  • 40
  • 81
  • I think your browser might block this as it can be used maliciously. – Halcyon May 14 '12 at 20:46
  • possible duplicate of [The javascript "resizeTo" function not working in Chrome and Opera](http://stackoverflow.com/questions/3641648/the-javascript-resizeto-function-not-working-in-chrome-and-opera) – Halcyon May 14 '12 at 20:49
  • Also, **wont fix** http://code.google.com/p/chromium/issues/detail?id=2091 – Halcyon May 14 '12 at 20:49

1 Answers1

4

Almost all new browsers disable this event by default for the reason of annoying users and malicious actions.

At some browsers users allowed to enable this action manually, but ~95% of users will have default settings. To enable resizing at Firefox you can go to about:config and set dom.disable_window_move_resize;true attribute to false

You can try to resize user window at any time with window.resizeTo(w,h); method and then check current user screen height. ie with jQuery method var curH =$(window).innerHeight(); and compere h with curH to be sure that its resized.

The better way to solve your problem is to allow users to drag files from the folder to the specific area of the screen or open dialog on action with multiple files selection.

Addons

Maybe the best choose will be to organize uploading at your website with own addon for most of popular browsers. You can write your own for Chrome, Opera and Firefox.

Advantages:

  • Users do not need to read tons of rules about how to enable something. Only few click to install addon.
  • Well-controlled and stability work.
  • You can provide access to files upload functionality without visiting your site at all.
abrahab
  • 2,430
  • 9
  • 39
  • 64
  • I already do both i just want to make it even more convenient for certain users because the website will be revolving around a lot of file uploading. I want to make that functionality solid so i never have to touch it again. I also am aware that i can compare before and after browser dimensions i just wondered if there is one function to check or a list of browsers that are compatible with resizeTo function. – Xitcod13 May 15 '12 at 00:12
  • Omg thanks... how about for other browsers like opera chrome safari?? Any idea?? – Xitcod13 May 15 '12 at 00:44
  • also is there a way to check in javascript if dom.disable_window_move_resize; is set to true or false?? – Xitcod13 May 15 '12 at 00:53
  • @Xitcod13 seems you have found solutions already and update your topic, but you are trying to invent a bicycle. check my new additions to the answer – abrahab May 15 '12 at 06:39
  • 1
    my website is for limited audience but with people that will be willing to set up their browsers to allow for quicker fileupload it will be a really nice functionality.I hate it when i can make something more convenient for a user but i dont and this is the core of the website so it needs to be as good as it can be. I allready +1 your answer because it does provide good content, but it doesnt fully answer my question.And i will make my addon if i absolutely have to but i need to know how browsers work first to know if my addon is even possible.but thank you very much your contribution is great – Xitcod13 May 15 '12 at 06:46
  • it is fully possible, because its no problem to open any sized dialog with the addon at any time for example with button from menu or check when button on the site is clicked and bind action to this event. anyway create new question if you want to know something specific. – abrahab May 15 '12 at 06:54