A web-based tool that analyzes and measures all resources loaded by a webpage, including HTML, CSS, JavaScript, images, videos, audio files, and more. This is a JavaScript/HTML conversion of the original Java Assignment1 project.
π Ready to deploy! See DEPLOYMENT.md for deployment instructions to GitHub Pages, Netlify, Vercel, and more.
Optimized for Speed: Uses parallel fetching, caching, and timeout protection to analyze websites 5-10x faster than sequential approaches.
- Performance Score Calculator: Get an overall performance score (0-100) similar to Google Lighthouse
- Analyzes page size, request count, resource distribution, and compression
- Color-coded indicators (Excellent/Good/Fair/Poor)
- Detailed breakdown of individual metrics
- Actionable insights for optimization
- Optimization Suggestions: Receive prioritized, actionable recommendations
- Image compression and modern format suggestions
- Code minification opportunities
- Server compression recommendations
- Request reduction strategies
- CDN usage analysis
- HTTPS security checks
- Duplicate resource detection - Identify resources loaded multiple times and calculate wasted bandwidth
- Potential bandwidth savings calculations
- Load Time Estimation: See estimated load times across different network connections
- 5 network profiles: 3G, 4G/LTE, 5G, WiFi, and Cable/Fiber
- Detailed breakdown: latency, download time, and parse/render time
- Speed categories with visual indicators
- Considers parallel connections and resource prioritization
- Treemap Visualization: Interactive visual representation of resource sizes
- Size-proportional rectangles for each resource
- Color-coded by resource type (HTML, CSS, JS, Images, etc.)
- Grouped by type with total size and file count
- Click resources for detailed information
- Toggle between grouped and flat views
- URL Analysis: Input any webpage URL and analyze all its resources
- Fast Parallel Fetching: Downloads up to 10 resources simultaneously
- Smart Caching: Avoids re-downloading duplicate resources
- Dynamic Loading: See results appear in real-time with progress tracking
- Resource Detection: Automatically detects and extracts:
- Images (including lazy-loaded with
data-srcandsrcset) - Stylesheets (CSS files)
- JavaScript files
- Video and audio files
- Fonts
- Iframes, embeds, and objects
- Resources in inline styles and
<style>blocks
- Images (including lazy-loaded with
- Size Calculation: Fetches and calculates the size of each resource
- Dark Theme UI: Clean, modern interface that's easy on the eyes
- Export Functionality:
- Export analysis results to CSV format (includes load time estimates)
- NEW! Generate comprehensive PDF reports with charts, recommendations, and professional formatting
- Statistics Dashboard: View total files, total size, and main HTML size at a glance
- Timeout Protection: 10-second timeout prevents hanging on slow resources
- A modern web browser (Chrome, Firefox, Safari, Edge)
- Internet connection (for CORS proxy and resource fetching)
-
Clone this repository:
git clone https://github.com/DanielChahine0/Webpage-Resource-Fetch-Analyzer.git cd Webpage-Resource-Fetch-Analyzer -
Open
index.htmlin your web browser:- Double-click the file, or
- Right-click and select "Open with" β your browser, or
- Use a local server (recommended):
# Python 3 python -m http.server 8000 # Node.js (with http-server) npx http-server
-
Visit
http://localhost:8000(if using a local server)
- Enter a URL in the input field (e.g.,
https://example.comor justexample.com) - Click the "Analyze" button
- Wait for the analysis to complete
- View the results including:
- Overall performance score with detailed breakdown
- Load time estimates for different network speeds
- Interactive treemap visualization
- Total number of files
- Total size of all resources
- Main HTML file size
- Detailed table of all resources with their names, types, sizes, and URLs
- Export results:
- CSV Export: Click "π Export CSV" for spreadsheet-compatible data
- PDF Report: Click "π Export PDF Report" for comprehensive analysis reports with charts and recommendations
https://en.wikipedia.org/wiki/MP3https://www.york.cahttps://example.com130.63.236.137(IPv4 addresses supported)
The project uses a modern, modular architecture for better maintainability:
Webpage-Resource-Fetch-Analyzer/
βββ index.html # Main HTML entry point
βββ README.md # This file
βββ src/
β βββ js/ # JavaScript modules (ES6)
β β βββ app.js # Application entry point
β β βββ core/ # Core business logic
β β β βββ resource-analyzer.js
β β β βββ resource-parser.js
β β β βββ resource-fetcher.js
β β β βββ performance-scorer.js
β β βββ ui/ # UI components
β β β βββ ui-controller.js
β β β βββ progress-display.js
β β β βββ results-display.js
β β β βββ performance-score-display.js
β β β βββ error-display.js
β β β βββ loading-display.js
β β β βββ csv-exporter.js
β β β βββ pdf-exporter.js # NEW: PDF report generation
β β βββ utils/ # Utility functions
β β βββ url-utils.js
β β βββ format-utils.js
β βββ css/ # CSS modules
β βββ main.css # CSS entry point
β βββ base.css
β βββ layout.css
β βββ input-form.css
β βββ progress.css
β βββ performance-score.css
β βββ results.css
β βββ table.css
β βββ error.css
β βββ responsive.css
βββ docs/ # Documentation
β βββ PROJECT_STRUCTURE.md # Detailed architecture guide
β βββ [other documentation files]
βββ assets/ # Static assets
For detailed information about the architecture, see docs/PROJECT_STRUCTURE.md.
- Automatically adds
https://if no protocol is specified - Converts
http://tohttps://for better security - Handles IPv4 addresses with reverse DNS lookup considerations
The analyzer extracts resources from:
<img>tags (includingdata-srcandsrcsetattributes)<script>tags withsrcattributes<link>tags (stylesheets and icons)<video>,<audio>, and<source>tags<iframe>,<embed>, and<object>tags- CSS
url()references in<style>blocks - Inline
styleattributes with background images
Due to browser security restrictions, this tool uses the AllOrigins CORS proxy service to fetch remote resources. This means:
- Some websites may not be accessible due to their own restrictions
- Fetching may be slower than direct access
- Large resources may take time to download
This web implementation mirrors the functionality of the original Java code:
| Java Implementation | Web Implementation |
|---|---|
normalizeURL() |
normalizeURL() |
collectResourceUrls() |
collectResourceURLs() |
fetchSize() |
fetchResourceSize() |
getBytes() |
fetchHTML() |
fileNameFromUrl() |
getFileName() |
extractUrlsFromCss() |
extractUrlsFromCSS() |
| HttpURLConnection | Fetch API with CORS proxy |
- CORS Restrictions: Some websites may block cross-origin requests
- Proxy Dependency: Relies on AllOrigins proxy service availability
- Size Accuracy: Some dynamic or protected resources may not be fetchable
- Performance: Larger sites with many resources may take time to analyze
This application is production-ready and can be deployed to various platforms:
- GitHub Pages - Free and automatic (recommended)
- Netlify - One-click deployment
- Vercel - Instant global deployment
- Cloudflare Pages - Fast CDN
- Traditional hosting - Upload via FTP
See DEPLOYMENT.md for detailed deployment instructions.
-
Prepare for production:
.\prepare-deploy.ps1 -
Push to GitHub:
git add . git commit -m "Ready for deployment" git push origin main
-
Enable GitHub Pages:
- Go to repository Settings β Pages
- Source: GitHub Actions
- Done! Site will be live at
https://yourusername.github.io/repo-name/
- DEPLOYMENT.md - Complete deployment guide for all platforms
- BUILD.md - Build and optimization instructions
- docs/PDF_EXPORT.md - PDF report generation feature guide
- docs/PDF_EXPORT_QUICK_START.md - Quick start for PDF reports
- docs/DUPLICATE_DETECTION.md - Duplicate resource detection feature guide
- docs/DUPLICATE_DETECTION_QUICK_START.md - Quick start for duplicate detection
- docs/ - Additional technical documentation
- Vanilla JavaScript (ES6+) - No frameworks, pure performance
- CSS3 - Modern responsive design
- Fetch API - Async resource fetching
- ES6 Modules - Clean, modular architecture
- Original Java implementation concepts and algorithms
- AllOrigins for CORS proxy service
This project is licensed under the MIT License - see the LICENSE file for details.
Daniel Chahine
- GitHub: @DanielChahine0
Contributions, issues, and feature requests are welcome!
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Give a β if this project helped you!