fix(web): allow user-activated top navigation for custom home iframe (#5955)
The custom home page URL iframe only allows allow-forms/allow-popups/ allow-popups-to-escape-sandbox/allow-scripts, without allow-top-navigation*. As a result, target="_top" nav/menu links inside the (admin-configured, trusted) embedded page cannot navigate the top-level window on desktop browsers, while some mobile browsers still allow it via allow-popups — causing inconsistent behavior rather than an intended restriction. Add allow-top-navigation-by-user-activation so user-clicked top-level links work consistently across devices. This token only permits user-activated top navigation and does NOT grant same-origin access, so it avoids the security concern of allow-same-origin. Co-authored-by: 贺. <kuang@M1.local> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+9
-1
@@ -72,12 +72,20 @@ export function Home() {
|
||||
if (isUrl) {
|
||||
return (
|
||||
<PublicLayout showMainContainer={false}>
|
||||
{/*
|
||||
allow-top-navigation-by-user-activation: the custom home page URL is
|
||||
admin-configured (trusted); this lets its target="_top" nav/menu links
|
||||
navigate the top-level window on user click. The default sandbox blocks
|
||||
this on desktop, while some mobile browsers allow it via allow-popups,
|
||||
causing inconsistent behavior. This token only permits user-activated
|
||||
top-level navigation and does NOT grant same-origin access.
|
||||
*/}
|
||||
<iframe
|
||||
ref={iframeRef}
|
||||
src={content}
|
||||
className='h-screen w-full border-none'
|
||||
title={t('Custom Home Page')}
|
||||
sandbox='allow-forms allow-popups allow-popups-to-escape-sandbox allow-scripts'
|
||||
sandbox='allow-forms allow-popups allow-popups-to-escape-sandbox allow-scripts allow-top-navigation-by-user-activation'
|
||||
onLoad={syncIframePreferences}
|
||||
/>
|
||||
</PublicLayout>
|
||||
|
||||
Reference in New Issue
Block a user