Page 1 of 2 1 2 LastLast
Results 1 to 15 of 22

Thread: resizeTo() Method doesn't work on all browsers except safari

  1. #1

    resizeTo() Method doesn't work on all browsers except safari

    Hello everyone,

    I'm sorry if this question of mine is so dumb to others, because I'm just starting to learn JavaScript. My question is about the resizeTo() method. When I tried this method it only works on safari and not all the other browsers(by the way I'm using all the updated browser as of this writing). I've search already it on the internet it says that this method is compatible in all browsers. Anyway I hope somebody can help me. Here's the method:

    Code:
    <body>
    <input type="button" value="800x600" onclick="window.resizeTo(800,600);" />
    </body>
    What's suppose to happen in this code is that when you click the button, the window size would be 800px x 600px. But when I tried it, it only works on safari. Why is that it only works on safari?

    Many thanks in advance.

  2. #2
    Senior Member
    England coothead's Avatar
    Join Date
    Feb 2003
    Location
    Chertsey, a small town 25 miles south west of London, England.
    Posts
    633
    Hi there orrange23,

    and a warm welcome to these forums.

    Modern users are a little more sophisticated than those of the twentieth century.

    The thought of someone resizing their browser is an anathema.

    The majority of modern browser makers understand this, and have written options
    that give control to the user rather than the coder.

    Safari does not appear have the same concern for it's customers, other than
    allowing them to disable javascript altogether.

    I would suggest that you concentrate more on learning customer friendly javascript.

    coothead
    Last edited by coothead; 18th July 2012 at 20:47. Reason: typo

  3. #3
    tegwar champ
    United Nations mmi's Avatar
    Join Date
    Oct 2000
    Location
    is everything
    Posts
    7,774
    Hey orrange23 and welcome to the forum that had a problem in the past with oranges:

    Name:  notoranges.gif
Views: 127
Size:  1.3 KB

    but figures that second ar makes all the difference.

    I'm not a scripter, but I've been around a few of them for several years, so I can throw out a couple of ideas that may or may not be of any use:

    • That code works for mme in IE8 — I guess most people have 9 now.
    • It does not work in mmy Firefox 13, even after I allowed for pop-up windows which I thought might be the problem. I also read that Firebug, which I have, can cause trouble, but that's with versions older than the one I have.
    • Firefox can be quite finicky in mmy experience. Issues like wanting FORM tags around any INPUT tags, wanting properly attributed SCRIPT tags around any JavaScript, and just insisting on standards in general. I fiddled with yer snippet, but couldn't get Firefox to like it.



    If you were doing this onLoad, I figure coothead would be correct. But with proper deference to his much greater knowledge concerning these matters , I can't see how clicking on a button diminishes viewer control.

    I did find some code that works in Ff, but only in a new window. Perhaps this can be used somehow to allow you to accomplish yer goal.

    "Until I feared I would lose it, I never loved to read. One does not love breathing." — Harper Lee (Scout, in To Kill a Mockingbird)

  4. #4
    Senior Member
    England coothead's Avatar
    Join Date
    Feb 2003
    Location
    Chertsey, a small town 25 miles south west of London, England.
    Posts
    633
    Hi there mmi,

    I can't see how clicking on a button diminishes viewer control.
    Well, modern browsers, tend to think that is does, and have therefore
    given us various options to prevent obtrusive javascript.

    Why would any one want to change my browser's dimensions.

    Aggravation, is the word that springs to mind.

    coothead

  5. #5
    Well, modern browsers, tend to think that is does, and have therefore
    given us various options to prevent obtrusive javascript.
    Because they're morrons! What about browser based applications that would allow the user to expand a window to fullscreen, 800x600 etc. The old hta's for windows. If browser developers were so smart how come something that works in one doesn't work in another! If they want to impress me they should come together a build a single standard instead of all the multi browser bs. Maybe then they could figure out a way to import any font style into a browser page. They're morrons, that's why you have soooo many doctypes and browser versions!

    special note: I got chinese characters in captcha...
    Anything Is Possible!!

  6. #6
    Senior Member
    England coothead's Avatar
    Join Date
    Feb 2003
    Location
    Chertsey, a small town 25 miles south west of London, England.
    Posts
    633
    Hi there c1lonewolf,

    Because they're morrons!
    I presume that you mean morons.

    If giving me the option of blocking pop-up windows, preventing my windows from being
    re-sized at the whim of juvenile coders, or disabling javascript altogether is moronic,
    then, I say long live morons.

    If browser developers were so smart how come something that works in one doesn't work
    in another!
    That is invariably due to inadequate coding skills.

    coothead

  7. #7
    Administrator
    UK diades's Avatar
    Join Date
    Feb 2001
    Location
    Glasgow, Scotland
    Posts
    15,664
    Blog Entries
    6
    Hi Guys

    There always used to be a rule that allowed one to open new windows, send data to the server, resize things and, generally, do what you want; it was called 'good manners' i.e., ask the user!

    "this will cause a new window to open, is that ok?"
    "this will send data to the server, is that ok"?
    "this will cause the window to resize so that it will load the application neatly, when you log off, the window will be returned to your previous settings, is that ok"?

    Most users do not mind if you give them the choice.

    "If they want to impress me they should come together a build a single standard instead of all the multi browser bs. Maybe then they could figure out a way to import any font style into a browser page. "

    Utopia

    Fortunately/unfortunately they are in competition which helps to drive things forwards. It is not so strange that a company wants mileage out of their research and work, it may not be to our liking but they are the ones with a wage bill to meet and investors to keep happy.

  8. #8
    tegwar champ
    United Nations mmi's Avatar
    Join Date
    Oct 2000
    Location
    is everything
    Posts
    7,774
    Hey again

    As you can see, this community is characterized by dispassionate technocrats who simply spit out code, rarely expressing personal opinions.

    Are you having a problem outside Firefox? I've been a Mozilla enthusiast since the early days of Netscape, when they more or less stood alone against the Evil Empire of the Insufferable Encumbrance. Name:  smilie3.gif
Views: 146
Size:  1.2 KB Nowadays, everybody seems to want Chrome. I don't have that. Anyone test for it?

    The fox indicates that:
    Since Firefox 7, it's no longer possible for a web site to change the default size of a window in a browser, according to the following rules:
    - You can't resize a window or tab that wasn’t created by window.open.
    - You can't resize a window or tab when it’s in a window with more than one tab.
    So maybe this restriction is related to the development of tabs.

    I looked around and found some discussion of self.resizeTo, but it didn't look very promising.

    This seems fairly definitive:
    Resizing with JavaScript has been made almost impossible beginning with Firefox 7.0.1 due to Bug 565541 – Web sites shouldn't be allowed to resize main window
    I still say offering a button sounds like viewer control t' mme.

    "Until I feared I would lose it, I never loved to read. One does not love breathing." — Harper Lee (Scout, in To Kill a Mockingbird)

  9. #9

    thank you all

    first of all i want to thank you all for all your replies. i really really really appreciate it.

    i just want to make things clear first that my question is just for learning purposes only. because i came about this method of the window object as i was reading the beginners guide javascript book. because when i tried the other example methods of the window object on the book it worked but when i tried this resizeTo() method it only worked on safari and not on the other browsers.

    but now atleast with all your help guys atleast i have a better understaning of what's going on. again i want to thank you all guys for all the help and advises you've given me. and also thanks to the book i'm reading if weren't for the book i wouldn't have found this website.

  10. #10
    Quote Originally Posted by mmi View Post
    Hey again

    As you can see, this community is characterized by dispassionate technocrats who simply spit out code, rarely expressing personal opinions.

    Are you having a problem outside Firefox? I've been a Mozilla enthusiast since the early days of Netscape, when they more or less stood alone against the Evil Empire of the Insufferable Encumbrance. Name:  smilie3.gif
Views: 146
Size:  1.2 KB Nowadays, everybody seems to want Chrome. I don't have that. Anyone test for it?

    The fox indicates that:So maybe this restriction is related to the development of tabs.

    I looked around and found some discussion of self.resizeTo, but it didn't look very promising.

    This seems fairly definitive:I still say offering a button sounds like viewer control t' mme.
    hi mmi,

    thank you for this information atleast i have an idea that firefox has this rules. i tried the resizeTo() method also on chrome and opera except internet explorer because i don't have an internet explorer, the method doesn't work on them just safari.

  11. #11
    Administrator
    UK diades's Avatar
    Join Date
    Feb 2001
    Location
    Glasgow, Scotland
    Posts
    15,664
    Blog Entries
    6
    i just want to make things clear first that my question is just for learning purposes only.
    No problem there orange, you are most welcome as that is what we are here for!

  12. #12
    Quote Originally Posted by coothead View Post
    Hi there orrange23,

    and a warm welcome to these forums.

    Modern users are a little more sophisticated than those of the twentieth century.

    The thought of someone resizing their browser is an anathema.

    The majority of modern browser makers understand this, and have written options
    that give control to the user rather than the coder.

    Safari does not appear have the same concern for it's customers, other than
    allowing them to disable javascript altogether.

    I would suggest that you concentrate more on learning customer friendly javascript.

    coothead
    hi coothead,

    thank you for your suggestions. i really appreciate it. one of your suggestion you said that i should concentrate more on learning customer friendly javascript. do you mind sharing what are this? i really don't know what it's about because i'm just starting to learn javascript and i'm taking it one step at a time. many thanks in advance for your help and understanding.

  13. #13
    Quote Originally Posted by diades View Post
    Hi Guys

    There always used to be a rule that allowed one to open new windows, send data to the server, resize things and, generally, do what you want; it was called 'good manners' i.e., ask the user!

    "this will cause a new window to open, is that ok?"
    "this will send data to the server, is that ok"?
    "this will cause the window to resize so that it will load the application neatly, when you log off, the window will be returned to your previous settings, is that ok"?

    Most users do not mind if you give them the choice.

    "If they want to impress me they should come together a build a single standard instead of all the multi browser bs. Maybe then they could figure out a way to import any font style into a browser page. "

    Utopia

    Fortunately/unfortunately they are in competition which helps to drive things forwards. It is not so strange that a company wants mileage out of their research and work, it may not be to our liking but they are the ones with a wage bill to meet and investors to keep happy.
    hi diades,

    thank you for the advises too, i'll always keep this in mind too when i'm already starting to wright codes for websites i'm going to build.

  14. #14
    I presume that you mean morons.
    How about "mo'rons".

    That is invariably due to inadequate coding skills.
    Even more mo'rons now than before with "inadequate coding skills".

    If giving me the option of blocking pop-up windows, preventing my windows from being
    re-sized at the whim of juvenile coders, or disabling javascript altogether is moronic,
    then, I say long live morons.
    Have to agree with you guys on this part by allowing the user the option. However, if you need to resize the window and they accept then don't they have to reset the browser to make a simple change? Then reset again each and every time? Seems uuhhh what's the word, redundant.

    "If they want to impress me they should come together a build a single standard instead of all the multi browser bs. Maybe then they could figure out a way to import any font style into a browser page. "

    Utopia

    Fortunately/unfortunately they are in competition which helps to drive things forwards. It is not so strange that a company wants mileage out of their research and work, it may not be to our liking but they are the ones with a wage bill to meet and investors to keep happy.
    If I only had a browser developer...It can't be that dang hard! I think they just look at it from the wrong angle. I mean, a browser can download images, videos, html,shtl,xhtml,xml, javascript and vbscript files etc. but you can't download and read a simple font font file? Give me a break.

    Like with IE and probably every other browser, you create a 400x400 div and position a 1 pixel object at 0,0 and one at 400,400 and you see both objects. However, if you you add a solid 1 px border to it you lose the 400,400 object. It's hidden under the border. So in actuallity your container has to be 401x401 because the mo'rons can't add a single pixel to the x & y border controls. Give me a break!

    And so what happens to all the apps that have been created using browser windows? When they become executables will they no longer work?

    I feel better now...hehehe
    Anything Is Possible!!

  15. #15
    Moderator
    Christmas Island Kool Dude's Avatar
    Join Date
    Jul 1999
    Location
    Sittin' on the dock of the bay...
    Posts
    405
    Hey orrange,

    Ahh... just replied to your other thread and was wondering what you ran into... yeah I imagine the book was just listing the properties and the browsers kind of changed how they did things over time. I think, as others have said, that the browsers restrict some functions from being run on the main window such as close(), resizeTo(), etc. They would probably work in a window you have opened using window.open() instead. It is mainly to keep unscrupulous sites from messing with your main window without warning/permission.

    Well, back to being Kool...

    I am soooooo Kool!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Object doesn't support this property or method
    By jhkrs in forum Client-side forum
    Replies: 4
    Last Post: 30th July 2003, 23:26
  2. Cookie 'doesn't support property or method'
    By GSHelpBoy in forum Client-side forum
    Replies: 2
    Last Post: 16th December 2001, 00:12
  3. Doesn't work on some browsers....
    By TupacLivesOn in forum Client-side forum
    Replies: 4
    Last Post: 12th June 2001, 21:34
  4. Doesn't work on some browsers....
    By TupacLivesOn in forum General Computing Forum
    Replies: 2
    Last Post: 1st June 2001, 20:45
  5. Replies: 2
    Last Post: 6th April 2001, 14:53

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •