User Details JavaScript Code Snippets

These snippets all deal with information about the visitors. See how many sites they’ve been to since they started their browser, their hostname, and a bunch of information about their browser.

Results via Envato Market

If you maintain separate pages, one plugin enhanced, the other not, here’s a simple way to send your visitors to the right page automatically. Besides being a very short script (it loads fast) you can modify the code to look for any plugin you want. Give it a try!

Do you maintain a different version of your site for Windows and another for Mac users? Or, when allowing your visitor to download items from your site, would you like to automatically redirect them to the appropriate software download page for their computer? This script does it all, and it’s short too!

If other sites links directly the sub-pages of your site or if previous required pages are being skipped, you can now require your visitors to come from a certain page! Those that did not come from the required page are alerted then send back to the required previous page. Clever!

Opens a new full screen browser window optimized for the visitor’s browser (Netscape, Internet Explorer, or Other). As well, the properties of new window can be customized — such as the toolbars, scrollbars, menu bar, location bar, the status bar, and whether it is resizable or not. Great!

If your visitor has JavaScript enabled in their browser, they are automatically redirected to your JavaScript-enhanced page. If their browser doesn’t support JavaScript or they have it disabled, the NOSCRIPT code will display a link to another page without JavaScript.

Neat little example which displays what JavaScript version the visitor’s browser supports. It’s pretty neat, extremely simple. Check it out!

(Version 4.0+ browsers) Redirects a user to the page based on their language. For example, English language user browsers, which report the language as ‘en’ in most cases, can be redirected to an English page, while Spanish language user browser, which report the language as ‘es’ in most cases, can be sent to a separate Spanish page. This method works well for redirecting users in all the languages that you set up. Instructions on adding more languages are included in the source code.

(Netscape 4.0+ with Java enabled only!) JavaScript can prevent visitors with certain IP addresses from visiting your site. Simply enter part of their IP address (the more you enter the greater the chance only the intended person will not be able to enter your site) and they will not be able to enter the site. If anyone has a Internet Explorer workaround, we’d love to post it here!

(Netscape only, and Java must be enabled) Whether it’s ethical or not, getting information on your site’s visitors is just plain neat. As one of the most requested scripts, this little gem will allow you to get the user’s IP address! Neat!

If Java is enabled in the visitor’s browser, they are redirected to a Java-enhanced page. Otherwise, if Java is disabled they are sent to the non-java page. Neat!

This script displays the user’s IP address in the title bar, status bar, and/or an alert box.

It is surprising to know that a web page can actually know how many pages you have been to this browser session. That is exactly what this script does.

(works only for Netscape Browsers with Java enabled) If you would like to show your visitors computer hostname, use this script. Very cool.