Failed to execute template. Cause: [Access denied when checking [script] access to [xwiki:Collaboratory.UX.HbpSkin.WebHome] for user [xwiki:XWiki.Admin]]. Click on this message for details.

Counting words in a Wiki page - HBP Wiki

IAM21 instance, do not create collab nor modify a team, your changes will be lost


Wiki source code of Counting words in a Wiki page

Last modified by hbpadmin on 2023/05/15 15:16

Show last authors
1 For web pages which don't include a feature to count words or characters on the page, a simple workaround is to use a **bookmarklet**. A bookmarklet is a bookmark stored in a web browser that contains commands (usually in JavaScript) that add new features to the browser. Bookmarklets are supported by most modern web browsers, possibly with limitations on mobile devices.
2
3 __**HOW TO**__:
4
5 1. Create any bookmark and store it in the __toolbar__ of your web browser. If it's stored elsewhere it will be much less practical and might not work for this specific purpose.
6 1. Edit the bookmark
7 11. change its name to e.g. "Count Words" or something significant to you
8 11. change its URL to the following single line (copy-paste it):
9 11*. javascript: (function(){var a=(document.selection?document.selection.createRange().text:document.getSelection()).toString();alert(a.length?"Characters: "+a.length+"\nWords: "+a.replace(/\s{2,}/g," ").split(" ").length:"No text selected.")})();
10 11. save the changes if needed in your browser, else simply return to this wiki page
11 1. To use it, simple select part of the text on a web page and click the bookmark in the toolbar of your browser.
12 1. A pop-up shows the character and word count
13
14