Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add JS cookies info to diagnostics #6491

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

add JS cookies info to diagnostics #6491

wants to merge 2 commits into from

Conversation

johnduffell
Copy link
Member

it would be useful to have a guide as to whether JS can get hold of cookies on the client side when users are having trouble

This PR adds these to the https://support.theguardian.com/cookies endpoint at the bottom

The JS is super hacky but it just about does the job. But improvements appreciated in case I've missed something (tested in latest chrome on desktop only)

image

val cookiesJS =
"<pre><script>document.write(document.cookie.split('; ').map((a) => a.split('=')).map((a) => a[0] + ' ' + a[1]?.length).join('\\n'))</script></pre>"
Html(
s"<html><body><h2>HTTP cookies</h2><pre>$body</pre><h2>JS cookie keys and lengths</h2>$cookiesJS</body></html>",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm relying on body and cookiesJS not needing any escaping here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the proper way would be to add a twirl template and let it handle the escaping

Copy link
Contributor

github-actions bot commented Nov 7, 2024

Size Change: 0 B

Total Size: 2.29 MB

ℹ️ View Unchanged
Filename Size
./public/compiled-assets/javascripts/[countryGroupId]/events/router.js 112 kB
./public/compiled-assets/javascripts/[countryGroupId]/router.js 259 kB
./public/compiled-assets/javascripts/ausMomentMap.js 108 kB
./public/compiled-assets/javascripts/contributionsRedirectStyles.js 20 B
./public/compiled-assets/javascripts/digitalSubscriptionLandingPage.js 242 kB
./public/compiled-assets/javascripts/downForMaintenancePage.js 69.3 kB
./public/compiled-assets/javascripts/error404Page.js 69.3 kB
./public/compiled-assets/javascripts/error500Page.js 69.2 kB
./public/compiled-assets/javascripts/favicons.js 617 B
./public/compiled-assets/javascripts/paperSubscriptionCheckoutPage.js 195 kB
./public/compiled-assets/javascripts/paperSubscriptionLandingPage.js 85.8 kB
./public/compiled-assets/javascripts/payPalErrorPage.js 67.6 kB
./public/compiled-assets/javascripts/payPalErrorPageStyles.js 20 B
./public/compiled-assets/javascripts/promotionTerms.js 72.2 kB
./public/compiled-assets/javascripts/subscriptionsLandingPage.js 71.5 kB
./public/compiled-assets/javascripts/subscriptionsRedemptionPage.js 126 kB
./public/compiled-assets/javascripts/supporterPlusLandingPage.js 312 kB
./public/compiled-assets/javascripts/unsupportedBrowserStyles.js 20 B
./public/compiled-assets/javascripts/weeklySubscriptionCheckoutPage.js 192 kB
./public/compiled-assets/javascripts/weeklySubscriptionLandingPage.js 85.8 kB
./public/compiled-assets/webpack/136.js 2.17 kB
./public/compiled-assets/webpack/187.js 21.5 kB
./public/compiled-assets/webpack/344.js 2.01 kB
./public/compiled-assets/webpack/671.js 21.8 kB
./public/compiled-assets/webpack/706.js 107 kB

compressed-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant