Skip to content

Cannot access localstorage from amp-script using sandboxed mode #35902

@zshnr

Description

@zshnr

Description

Hey all,

I've been trying to access LocalStorage using the new-ish sandboxed mode of amp-script (introduced in PR #33643). However, while it should support LS access I can't seem to access localStorage. I've tried both a src file and inline scripts.

The error I get in console is:

localStorage is not defined.

cc: @samouri

Reproduction Steps

I made a small example in amp playground here

Run it / open it and check console for the error

Relevant Logs

Uncaught ReferenceError: localStorage is not defined
    at amp-script[script="local-storage-script"].js:4

Browser(s) Affected

No response

OS(s) Affected

No response

Device(s) Affected

No response

AMP Version Affected

2108192119000

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions