perice
1
Hey all,
the redirect for my embedded apps has stopped working in the last day or so.
Temporary fix was to replace it with a simple window top location href:
window.top.location.href = url;
//await window.shopify.navigation.navigate(url);
It is, of course, annoying, as my users couldn’t use the app.
What’s the solution for this?
I’d say I have a pretty much standard setup, an embedded app.
Thanks,
Peter
1 Like
Elana
2
Hi @perice ,
We shipped a fix for this earlier this morning! Can you confirm if it is still a problem?
perice
3
Hey @Elana ,
not working for me, this code:
await shopify.navigation.navigate(url);
throws:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘navigate’)
at Object.navigate
at Object.redirectToAdmin
Claude suggested this, and this works:
const parsed = new URL(url, location.href);
if(window.top !== window)
{
open(parsed.pathname + parsed.search + parsed.hash, ‘_self’);
} else
{
window.location.href = url;
}
Are you sure window.shopify.navigation.navigate ever works? `window.open(url, ‘_top‘)`
perice
5
It worked, and it’s also documented here: