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

JavaScript can even display how long your web page has been online. Just enter the date, the script does the calculations, and prints out the time. It has a very nice readout and looks very professional!

(4.0+ browsers) Ever wanted to prevent users from “borrowing” images from your site through right-clicking them and “save image as…” or right-clicking the page and viewing your page source? This script will (attempt to) disable the right click on your page! As explained, however, this script is not fool-proof !!

Displays a message based on the extension (like .html) of the web page. And, it is a breeze to add more file types to the script.

This script displays an alert box when a visitor right clicks on an image. IE only. (Note: This script is not fool-proof. Visitors can disable JavaScript support in their browser, use a browser which doesn’t support JavaScript, or use a browser to link directly to the image that you want to protect.)

When visitors using Netscape right-click your web page and select “View Source” or go to the View menu bar and select “View -> Page Source” the entire source code of your page is displayed. Interestingly enough, it’s possible to actually insert an image into Netscape’s view source page instead of just having text. When Netscape users view the source of your page, they see an image as well as the source code! Your image could tell the visitor that they are not allowed to view this source code, for example. A very simple but very clever script, indeed.

Highlight new content or special items on your site for a specified amount of time. This script will display a “new” icon and highlight the header of the content until the date you set has expired. (You could also use it to highlight the content itself.) Adapted from “New Links” by Nicolas.

Displaying links as new for a few weeks after adding them is great. But, adding, removing, and updating that “New” icon for each link is pointless! Let JavaScript do your work for you! Just add a small code (less than 40 characters) next to each link with the date you want it to expire, and it will automatically display the “New” icon until the expiration date. What a time-saver!

An ingenious little JavaScript to track the movement of the user’s mouse and the location of mouse “events” (click, double-click, etc.) Works in both Netscape and Internet Explorer!

Bubbles float up from mouse giving the effect that the mouse is under water. The bubbles even expand in Internet Explorer.

Capture mouse X – Y positions with this easy script. Works much like our Mouse Tracker script, but much simpler! Compatible in Internet Explorer and Netscape versions 4+. Great!

Keeps logo (or text) in the bottom right corner of the browser window as they scroll the page up and down. The logo glides very smoothly when the page is scrolled and looks great. When their cursor is on the logo, a menu appears in its place offering links to different sections of the site. The menu returns to the logo a few seconds after the move the cursor off the menu. Neat!

When other sites link directly to a page of your frames site that should be viewed inside your frames, you can foil them with this script. It will reload that page inside your frames!