Page Details JavaScript Code Snippets

These snippets all deal with Page Detail JavaScripts. There are several snippets that do make a site more pleasant to visit. You can write the time a visitor entered the page, how long they’ve been there, write when the page was last updated, whether it was updated since you last visited, and lots more.

Results via Envato Market

(Internet Explorer Only) Displays a menu when the visitor right click’s on the page. You can easily use style sheets to modify the menu ‘skins’, or write your own. Awesome!

Useful for webmasters, this script lets you view any web page at different resolutions by simply clicking the link and entering the height and width values. Tip: You can drag the link to your “Links” toolbar, and use it on any page you are viewing.

Sends the focus to a window by putting it on top of the other open windows. Useful if you need to open a window but keep another window on top! It can even send the focus once every certain number of seconds, neat!

Keep your content fresh. Use this snippet to reload a fresh copy of your Web page from the server. Use either a button or a link. It’s compact but very effective.

Useful for situations when a page resize moves the page elements improperly or causes JavaScript errors, which has been known to occasionally occur on pages with layers. As a solution, this script reloads the web page when the user resizes the page.

This script strips excess spaces and non-printing characters from a field.

Users sometimes enter ” ” in required fields to trick most validation that only checks for “” length fields. This script takes a string and removes the leading and trailing spaces and also any extra spaces in the string.

Displays a small ‘image loading’ picture while the main image is loading. When the image completes, the viewer window is appropriately resized, centered on the screen, and ‘image loaded’ is displayed. Neat!

Keep your content fresh. Use this script to automatically reload a fresh copy of your Web page from the server. You determine the time delay between refreshes.

(4.0+ browsers) Keep visitors from stealing your site images by right-clicking and then selecting “Save Image As…” This script will disable the right click on all the images on your site. Not foolproof, but helpful!

Ever wondered how to make those cool random title messages? This script will do it for you! The title at the top of the page changes each time the page is loaded. Pretty neat!

Not exactly the most used script, but this one allows you to reference the page name in a variable. Instead of yourdomain.com/index.html, you can use this script to create a variable that stores index.html for your use! You can use it with alerts, document.write, etc. Take a look!

Displays a loading message as the page, including images and sound elements, are loaded in the background. When the page finishes loading the screen is shown, similar to how Macromedia’s Flash plugin works. Easy!

This is an incredibly simple script. It pulls each H4 element and creates a clickable index to it. It stuffs the headings it finds in a division named indexDiv and if it didn’t find any H4 tags it will even make the indexDiv invisible. You can also change it to use any other heading element.