Enter the URL of a website:
Word Count: 0
Webpage Word Counter Tool
This tool is a "Webpage Word Counter Tool" — a simple web-based utility that lets users count the number of words on any publicly accessible website.
Key Features
1. User Input
- The user enters a full website URL (e.g.,
https://example.com
) into a styled input field.
2. Fetch Website Content
- On clicking the "Count Words" button, the script:
- Uses a CORS proxy service (
https://api.allorigins.win
) to fetch the website’s HTML content (bypassing cross-origin restrictions). - Parses the HTML using the browser’s
DOMParser
.
- Uses a CORS proxy service (
3. Extract and Count Words
- Extracts visible text (
innerText
) from the HTML body. - Uses a regular expression to match word-like patterns (
\b\w+\b
). - Counts the total number of words and displays it on the page.
Limitations
- CORS restrictions: This tool works only with sites that can be fetched via a public proxy.
- JavaScript-only: There's no backend involved, so it's limited to browser security constraints.
- May not work on JavaScript-heavy or SPA (Single Page Application) sites where content loads dynamically after page load.
Use Cases
- Quickly estimate the length of an article or blog post on a site.
- Check word count for SEO or writing analysis.
- Educational tool for learning about DOM parsing, CORS, and JavaScript word processing.