Bookmarklets: Informations on the Page
These codes do not work if the page is in a frame, which also is becoming scarce.
Number of links in the page
Makes use of the link property of document.
Images without alt attribute
Another design tool, this bookmarklet indicates missing alt attributes.
For demonstration purposes, I have incorporated two images on this page... The first beeing without alt attribute should display null, but the second has one that is the title of the image: "Prado beach."
Origin of the page
Displays the page that has been entrusting the current page, or displays null when the URL was typed directly into the address bar of the browser.
Firefox and Internet Explorer
Last update date
The lastModified attribute of the document object is used. This is not a standard attribute and it does not work with all browsers. It is implemented in Firefox and Internet Explorer.
Code of the bookmarklet:
The same code can also be placed in the body of the page to indicate to visitors when the document was last updated:
Counting of words in a selection
Give the number of words in a text you've selected on the page.
Can not operate on the entire page as reading the content of the page returns HTML code with all the tags.
Uses getSelection() of the document object that is not standard and can not work with all browsers. Does not work with Internet Explorer but as a development tool, it is especially important that it be recognized by Firefox.