beautiful sky

Current Location: Home->Tutorials->Javascript->Browser Functions

A full list of browser functions and how you can use them:

In my opinion Browser Functions are the most important functions while writing Javascript! This is because different browsers will interpret your script differently, an example of this is that IE actually reads your javascript as Jscript (Microsoft's version of javascript). Using browser detection will enable cross-browser compatibility.

Two examples of how Browser detection Methods can help are:

1. Instead of including links to pages in alternate languages, why not use javascript to auto-detect the user language and redirect them automatically.

2. You wish to create a new page element. It would be useful to know the users screen size prior to enable you to adjust the size suitably.
 




The users screen width can be useful as you can either adjust object sizes to suite or redirect to a more suitable page.




The users screen Height can be used in the same way the users width is.




It is useful to know how far down the page the user has scrolled, as you can then use this information to move menu bars down the screen as the user scrolls.




The users scroll amount right can be used in the same way as the scroll amount down.




The browser information being the most important, it can be extremely useful as different browsers interpret code differently and support different file formats. Once you have used this code to determine which browser is being used you can adjust objects to suit or redirect.




As with browser information the platform information is useful as different platforms interpret code differently and support different file formats. This code is generally used to determine weather the user is browsing with a mac or windows based system.




History Information can be used to tell roughly how long a user has been browsing the internet. Also the history function can be used to navigate forward and back through the users page history. code: history.back(); history.forward();




Allows you to detect weather javascript is enabled in the users browser. You could use this to determine weather to import a js file or not.




Decide what colours to use after you know weather the user is browsing in 16 or 32 bit.




Knowing the window width can be very important for movement and sizing of interactive objects.




Knowing the window height has the same impotency as the window width.




This enables to to determine the user speed and redirect to a more appropriate page.




redirect users to pages of their default language. Whenever i come across a web site in a foreign language i usually leave straight away rather than searching for language options. With this feature you can ensure loading a page with an appropriate local language. Weather your own translation or you can redirect to google translations.




a user might browse with a different language setup than their system you could offer them a choice or just redirect to their browsing language.




Is the users browser on-line or off-line. This is used to determine weather the page is a cache or live. You may wish to inform the user they are browsing off line, if you have regular updates to your site.




If your site uses cookies check and alert users when they have cookies disabled.




can be useful for moving objects, online calendars...




if your javascript is located in an external page you may wish for different functions to kick in depending which html page the user is browsing why not use this code to difrenciate them.


Main Links

Design Tools

Javascript Tutorials

CSS Tutorials

Design Tutorials

Links