Which Is The Very Very Fast X2 Mobile Browser?

Javascript: Resize window based upon browser type

  • I'm looking for a javascript that will resize a browser window's size automatically as a page loads (not off of a link) depending upon the browser type. Obviously, I'm looking for something that will distinguish between IE and NN > 4.0, but I need the js to make account for other browsers as well. The size of the browser needs to be defined in pixels, not percentage. The logic of the js might look something like this: -On page load -if browser=IE, then resize window to x1,y1 -if browser=NN, then resize window to x2,y2 -if browser <> IE or NN then resize window to x3,y3. If it helps, you can study my patchwork solution at: www.concoctiondesign.com/beta/about/about.html I'm using DW MX to build this site, and I don't know JS to save my life, so it needs to be plug and play. I'll tip $5 for a clean, working piece of js!!

  • Answer:

    Hi koalb, the script you are looking for might look like this one: <HTML> <HEAD> <TITLE> Window Resizing Test </TITLE> <script language="JavaScript"> <!-- br=navigator.appName; brversion=parseInt(navigator.appVersion); x1=100; y1=100; x2=200; y2=200; x3=300; y3=300; if (br=="Netscape" && brversion>=4) { window.resizeTo(x1,y1); alert("Navigator"); } else { if (br=="Microsoft Internet Explorer") { window.resizeTo(x2,y2); alert("IE"); } else { window.resizeTo(x3,y3); alert(br); } } //--> </script> </HEAD> <BODY BGCOLOR="#FFFFFF"> <h1>test</h1> </BODY> </HTML> I have included a link in the additional sources section that shows how exactly you can detect other browsers than the ones you asked in your question. I have also added alerts, so you can see that the browser detection works correctly. I hope this helps. If you have any problems with the script or require additional information, feel free to request a clarification at any time. voyager-ga Additional Sources The Ultimate JavaScript Client Sniffer, Version 3.03: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html Search Strategy resize window javascript ://www.google.com/search?sourceid=navclient&q=resize+window+javascript javascript browser version ://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=javascript+browser+version

koalb-ga at Google Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.