Skip to content

Commit 74431a2

Browse files
committed
Release v2.2: Bug fixes and improvements
- Fixed history feature to show page titles instead of URLs - Enhanced React 18+ detection for modern applications - Added comprehensive error handling in pageAnalyzer() - Fixed icon display issues (converted WebP to PNG format) - Updated documentation (CHANGELOG, ROADMAP, STORE_DESCRIPTION, TESTING) - Created promotional images for Chrome Web Store - Updated privacy policy date to 2024-10-14 - Added MIT License file Technical improvements: - Try-catch error handling in analyzer.js - Better React detection for modern React 18+ apps - Improved fallback behavior on restricted pages - PNG icons in 3 sizes (16px, 48px, 128px) Documentation: - New CHANGELOG.md with version history - New ROADMAP.md with future features - New TESTING.md with comprehensive testing guide - New STORE_DESCRIPTION.md for Chrome Web Store - Enhanced README with better structure and details - Added CLAUDE.md for AI development assistance
1 parent 8dede17 commit 74431a2

20 files changed

+1462
-58
lines changed

CHANGELOG.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Changelog
2+
3+
All notable changes to the CSR vs SSR Detector extension will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [2.2] - 2024-10-14
9+
10+
### Added
11+
- Try-catch error handling in `pageAnalyzer()` function for better stability
12+
- Additional React detection selectors for modern React 18+ applications
13+
- Better error reporting with fallback analysis results
14+
- MIT License file
15+
- Comprehensive documentation (CHANGELOG.md, ROADMAP.md, enhanced README.md)
16+
17+
### Fixed
18+
- Function call argument order in `popup.js:60` (history saving bug)
19+
- React detection for applications without legacy `[data-reactroot]` attribute
20+
- Privacy policy date correction (2025 → 2024)
21+
- Improved error handling for DOM operations on restricted pages
22+
23+
### Changed
24+
- Enhanced README.md with better structure, badges, and detailed sections
25+
- Updated documentation with clear installation, usage, and contributing guidelines
26+
27+
## [2.1] - 2024-07-03
28+
29+
### Added
30+
- Privacy policy documentation
31+
- Sequence diagram illustrating detection flow
32+
- Improved UI with modern design system
33+
34+
### Changed
35+
- Enhanced detection algorithm with weighted scoring
36+
- Better confidence calculation based on indicator count
37+
- Improved visual feedback with confidence bars
38+
39+
### Fixed
40+
- Performance timing analysis edge cases
41+
- History display formatting
42+
43+
## [2.0] - 2024-05-26
44+
45+
### Added
46+
- Complete UI/UX redesign with modern interface
47+
- Enhanced analysis engine with more accurate detection
48+
- History tracking feature (stores last 10 analyses)
49+
- Performance metrics display (DOM ready time, FCP)
50+
- Framework-specific detection for:
51+
- Next.js, Nuxt, Gatsby, Remix, SvelteKit
52+
- Astro, Qwik, SolidJS
53+
- Jekyll, Hugo, Eleventy, Hexo
54+
- Detailed indicator display showing detection signals
55+
- Visual confidence bars for analysis results
56+
- Desktop notifications for analysis completion
57+
- Help section explaining SSR vs CSR differences
58+
59+
### Changed
60+
- Migrated to Chrome Manifest V3
61+
- Improved scoring algorithm with multiple weighted indicators:
62+
- HTML content analysis
63+
- Framework hydration markers
64+
- Serialized data detection
65+
- Meta tags and SEO analysis
66+
- Script analysis and code splitting patterns
67+
- Performance timing metrics
68+
- Client-side routing detection
69+
- Structured data presence
70+
- Better classification with 5 render type categories:
71+
- Server-Side Rendered (SSR)
72+
- Client-Side Rendered (CSR)
73+
- Likely SSR with Hydration
74+
- Likely CSR/SPA
75+
- Hybrid/Mixed Rendering
76+
- Enhanced UI with color-coded results
77+
- Improved extension popup design
78+
79+
### Fixed
80+
- Validation rules for SSR and CSR detection
81+
- Script injection reliability
82+
- Performance on complex web applications
83+
84+
## [1.0] - Initial Release
85+
86+
### Added
87+
- Basic SSR vs CSR detection functionality
88+
- Simple popup interface
89+
- Chrome extension with basic analysis
90+
- Detection based on:
91+
- Initial HTML content
92+
- JavaScript framework presence
93+
- Basic meta tag analysis
94+
95+
---
96+
97+
## Version History Summary
98+
99+
- **v2.1**: UI polish, privacy policy, documentation improvements
100+
- **v2.0**: Major redesign with advanced detection, history, and modern UI
101+
- **v1.0**: Initial release with basic detection capabilities

CLAUDE.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is a Chrome Manifest V3 extension that detects whether a webpage uses Server-Side Rendering (SSR) or Client-Side Rendering (CSR). The extension is published on the Chrome Web Store and helps developers and SEO specialists understand page rendering strategies.
8+
9+
## Development Setup
10+
11+
### Loading the Extension
12+
13+
1. Open Chrome and navigate to `chrome://extensions`
14+
2. Enable "Developer Mode" (toggle in top-right)
15+
3. Click "Load unpacked" and select the project directory
16+
4. The extension icon will appear in the Chrome toolbar
17+
18+
### Testing Changes
19+
20+
After making code changes:
21+
1. Go to `chrome://extensions`
22+
2. Click the refresh icon on the CSR vs SSR Detector card
23+
3. Test the extension on various websites (e.g., Next.js sites, React SPAs, static sites)
24+
25+
### No Build Process
26+
27+
This is a vanilla JavaScript project with no build step, transpilation, or package manager. All files are loaded directly by Chrome.
28+
29+
## Architecture
30+
31+
### Three-Part Execution Model
32+
33+
The extension uses Chrome's Manifest V3 architecture with three distinct execution contexts:
34+
35+
1. **background.js** (Service Worker)
36+
- Runs in the background as a service worker
37+
- Listens for extension icon clicks via `chrome.action.onClicked`
38+
- Orchestrates script injection into the active tab
39+
- Handles notifications and saves analysis history to `chrome.storage.local`
40+
- Maximum 10 history entries stored
41+
42+
2. **analyzer.js** (Content Script - Injected)
43+
- Injected into the target webpage on-demand
44+
- Exposes `window.pageAnalyzer()` function that performs the core analysis
45+
- Analyzes DOM structure, meta tags, script tags, performance timing, and framework markers
46+
- Returns structured analysis results with:
47+
- `renderType`: Classification (SSR/CSR/Hybrid/etc.)
48+
- `confidence`: Percentage (30-95%)
49+
- `indicators`: Array of detection signals
50+
- `detailedInfo`: Scores, frameworks detected, performance metrics
51+
- Also exposes helper functions: `getTypeColor()`, `getConfidenceBar()`, `createResultsHTML()`
52+
53+
3. **popup.js** (Popup UI)
54+
- Runs when user clicks extension icon and popup opens
55+
- Handles "Analyze Page" button click
56+
- Injects `analyzer.js` into the active tab
57+
- Calls `window.pageAnalyzer()` and `window.createResultsHTML()` in the tab context
58+
- Displays formatted results in the popup
59+
- Manages history display and toggle functionality
60+
61+
### Detection Algorithm (analyzer.js)
62+
63+
The `pageAnalyzer()` function uses a weighted scoring system:
64+
65+
- **SSR Indicators** (increase ssrScore):
66+
- Rich initial content (paragraphs, headings, articles)
67+
- Framework hydration markers (React, Next.js, Nuxt, Gatsby, Remix, etc.)
68+
- Serialized data (`__NEXT_DATA__`, `__INITIAL_STATE__`, etc.)
69+
- Rich meta tags and SSR framework meta
70+
- Fast performance timing (DOM ready < 30ms, FCP < 800ms)
71+
- Structured data (JSON-LD)
72+
- Low script-to-content ratio
73+
74+
- **CSR Indicators** (increase csrScore):
75+
- Minimal initial text content
76+
- Client-side routing elements
77+
- Loading states with minimal content
78+
- Slow DOM ready time (> 500ms)
79+
- High script-to-content ratio
80+
- Framework scripts without hydration markers
81+
82+
- **Final Classification**:
83+
- `ssrPercentage = (ssrScore / (ssrScore + csrScore)) * 100`
84+
- ≥75%: "Server-Side Rendered (SSR)"
85+
- ≤25%: "Client-Side Rendered (CSR)"
86+
- 60-74%: "Likely SSR with Hydration"
87+
- 26-40%: "Likely CSR/SPA"
88+
- 41-59%: "Hybrid/Mixed Rendering"
89+
90+
### Key Files
91+
92+
- **manifest.json**: Chrome extension configuration (Manifest V3)
93+
- **popup.html/popup.js**: Extension popup interface
94+
- **background.js**: Background service worker for icon clicks
95+
- **analyzer.js**: Core detection algorithm (injected as content script)
96+
97+
## Framework Detection
98+
99+
The extension detects these frameworks and generators:
100+
101+
**SSR Frameworks**: Next.js, Nuxt, Gatsby, Remix, SvelteKit, Astro, Qwik, SolidJS
102+
**Static Site Generators**: Jekyll, Hugo, Eleventy, Hexo
103+
**SPA Frameworks**: React, Vue, Angular, Svelte, Solid
104+
105+
Detection is performed via:
106+
- DOM markers (`#__next`, `data-reactroot`, `[q:container]`, etc.)
107+
- Meta tags
108+
- Script src patterns (`_next/static`, `_nuxt/`, `chunk`, etc.)
109+
- Inline serialized data patterns
110+
111+
## Common Modifications
112+
113+
### Adding New Framework Detection
114+
115+
To detect a new framework, update `analyzer.js`:
116+
117+
1. Add to `frameworkMarkers` object (line 27-36):
118+
```javascript
119+
newframework: document.querySelector('[data-newframework]') !== null
120+
```
121+
122+
2. Or add to static site generators (line 129-134):
123+
```javascript
124+
newgenerator: document.querySelector('meta[name="generator"][content*="NewGen"]') !== null
125+
```
126+
127+
### Adjusting Scoring Weights
128+
129+
Modify the score increments in `analyzer.js` to change detection sensitivity:
130+
- Higher scores = stronger signal for that rendering type
131+
- Current range: 10-40 points per indicator
132+
133+
### Modifying History Limit
134+
135+
Change the limit in both `background.js:70` and `popup.js:166`:
136+
```javascript
137+
if (history.length > 10) history.pop(); // Change 10 to desired limit
138+
```
139+
140+
## Chrome Extension APIs Used
141+
142+
- `chrome.action`: Extension icon clicks
143+
- `chrome.scripting.executeScript`: Code injection into tabs
144+
- `chrome.storage.local`: Persistent history storage
145+
- `chrome.notifications`: Desktop notifications (background.js only)
146+
- `chrome.tabs.query`: Get active tab information
147+
148+
## Permissions
149+
150+
Declared in manifest.json:
151+
- `activeTab`: Access current tab when extension is clicked
152+
- `scripting`: Inject and execute scripts
153+
- `storage`: Save analysis history
154+
- `notifications`: Show desktop notifications

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 dzienisz
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)