Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html>
<html>
<head>
<title>Bug 1663192 - Accessing localStorage in a file urls</title>
</head>
<script>
window.addEventListener("DOMContentLoaded", () => {
let result = document.getElementById("result");
try {
window.localStorage.setItem("foo", "bar");
result.textContent = "PASS";
} catch (e) {
result.textContent = "FAIL";
}
}, { once: true });
</script>
<body>
<a id="result"></a>
</body>
</html>