Skip to content

Commit 0bc9f80

Browse files
authored
Merge pull request #80 from hotwired/iframe-cross-origin-redirect-fix
Ignore cross-origin redirects that aren’t happening in the main frame
2 parents 4101cba + dc590b0 commit 0bc9f80

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Source/Turbo/Visit/ColdBootVisit.swift

+7
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ extension ColdBootVisit: WKNavigationDelegate {
7575
return
7676
}
7777

78+
// Allow navigation if it happens inside an iframe (sub-frame).
79+
// This prevents iframe loads from being treated as a full navigation during cold boots.
80+
guard let targetFrame = navigationAction.targetFrame, targetFrame.isMainFrame else {
81+
decisionHandler(.allow)
82+
return
83+
}
84+
7885
let isRedirect = location != url
7986
let redirectIsCrossOrigin = isRedirect && location.host != url.host
8087

0 commit comments

Comments
 (0)