diff --git a/src/puter-js/src/index.js b/src/puter-js/src/index.js index 84f490264..11fb46dd1 100644 --- a/src/puter-js/src/index.js +++ b/src/puter-js/src/index.js @@ -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) {