-
-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
Pages that contain window.location in code snippets are incorrectly classified as js-redirect.
See the following examples:
https://docs.contentsquare.com/en/web/artificial-pageviews/
https://docs.contentsquare.com/en/web/sending-pageviews/
https://docs.contentsquare.com/en/csq-sdk-android/experience-analytics/troubleshooting/
Should afdocs strip <code> and <pre> block contents before applying JS_REDIRECT_PATTERNS to the response body?
afdocs/src/checks/url-stability/redirect-behavior.ts
Lines 13 to 14 in 9c198cf
| const JS_REDIRECT_PATTERNS = | |
| /window\.location\s*[=.]|document\.location\s*[=.]|location\.href\s*=|location\.replace\s*\(|<meta[^>]+http-equiv\s*=\s*["']?refresh["']?/i; |
Test run for reproduction
pnpm exec afdocs check https://docs.contentsquare.com/en/csq-sdk-android/experience-analytics/troubleshooting/ \
--sampling none \
--checks redirect-behavior \
--format json
Output
{
"url": "https://docs.contentsquare.com/en/csq-sdk-android/experience-analytics/troubleshooting/",
"timestamp": "2026-03-17T20:29:46.930Z",
"specUrl": "https://agentdocsspec.com/spec/",
"results": [
{
"id": "redirect-behavior",
"category": "url-stability",
"status": "fail",
"message": "1 JavaScript redirect(s) detected across 1 pages",
"details": {
"totalPages": 1,
"testedPages": 1,
"sampled": false,
"noRedirectCount": 0,
"sameHostCount": 0,
"crossHostCount": 0,
"jsRedirectCount": 1,
"fetchErrors": 0,
"pageResults": [
{
"url": "https://docs.contentsquare.com/en/csq-sdk-android/experience-analytics/troubleshooting",
"status": 200,
"classification": "js-redirect"
}
],
"discoveryWarnings": []
}
}
],
"summary": {
"total": 1,
"pass": 0,
"warn": 0,
"fail": 1,
"skip": 0,
"error": 0
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels