-
Notifications
You must be signed in to change notification settings - Fork 13
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
base: main
Are you sure you want to change the base?
Conversation
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>", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Size Change: 0 B Total Size: 2.29 MB ℹ️ View Unchanged
|
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)