From d84f19df1c4d459679a45b8f5c412cc27e23400d Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Thu, 30 Nov 2023 16:21:19 -0500 Subject: [PATCH] Return pass through the query string and hash Fixes posit-dev/r-shinylive#28 --- src/Components/Viewer.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Components/Viewer.tsx b/src/Components/Viewer.tsx index adefea43..97116a81 100644 --- a/src/Components/Viewer.tsx +++ b/src/Components/Viewer.tsx @@ -29,6 +29,8 @@ function setupAppProxyPath(proxy: PyodideProxy | WebRProxy): { } { const appName = `app_${utils.makeRandomKey(20)}`; const urlPath = appName + "/"; + // Pass through any query string or hash in the outer URL to the iframe url. + const srcPath = urlPath + window.location.search + window.location.hash; if (!navigator.serviceWorker.controller) { throw new Error("ServiceWorker controller was not found!"); @@ -49,7 +51,7 @@ function setupAppProxyPath(proxy: PyodideProxy | WebRProxy): { } }); - return { appName, urlPath }; + return { appName, urlPath: srcPath }; } // Register the app path with the service worker