Allow multipage apps in puterjs (#1368)
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test (18.x) (push) Has been cancelled
test / test (20.x) (push) Has been cancelled
test / test (22.x) (push) Has been cancelled

* Allow multipage apps in puterjs

* Don't error on browsers which dont support sessionStorage
This commit is contained in:
Neal Shah
2025-07-21 14:02:46 -07:00
committed by GitHub
parent e14e1acd95
commit 6d09566ba7
+4 -3
View File
@@ -126,12 +126,13 @@ export default globalThis.puter = (function() {
context.services = this.services;
// Holds the query parameters found in the current URL
let URLParams = new URLSearchParams(globalThis.location?.search);
let URLParams = new URLSearchParams(globalThis.sessionStorage?.getItem("puter_search_params") || globalThis.location?.search);
// Figure out the environment in which the SDK is running
if (URLParams.has('puter.app_instance_id'))
if (URLParams.has('puter.app_instance_id')) {
globalThis.sessionStorage?.setItem("puter_search_params", globalThis.sessionStorage?.getItem("puter_search_params") || globalThis.location?.search)
this.env = 'app';
else if(globalThis.puter_gui_enabled === true)
} else if(globalThis.puter_gui_enabled === true)
this.env = 'gui';
else if (globalThis.WorkerGlobalScope) {
if (globalThis.ServiceWorkerGlobalScope) {