Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

fix: better iframe navigation#193

Open
dummdidumm wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromfix-iframe-navigation

Conversation

@dummdidumm
Copy link
Member

alternative to#187 which keeps the back/fwd navigation while also fixing the weird history pollution from iframe to parent (which was there regardless of the back/fwd navigation feature)

  • uses postMessage to trigger the inner SvelteKit's goto method
  • monkeypatches iframe's history.pushState to use replaceState instead to not create history entries, keeping the parent window's navigation order intact

- uses postMessage to trigger the inner SvelteKit's goto method- monkeypatches iframe's history.pushState to use replaceState instead to not create history entries, keeping the parent window's navigation order intact
@vercel
Copy link

vercelbot commentedJan 24, 2023
edited
Loading

The latest updates on your projects. Learn more aboutVercel for Git ↗︎

NameStatusPreviewCommentsUpdated
learn-svelte-dev✅ Ready (Inspect)Visit Preview💬Add your feedbackJan 24, 2023 at 7:44PM (UTC)

@Rich-Harris
Copy link
Member

This will break any tutorials that involvenavigation.type, no?

@Rich-Harris
Copy link
Member

(I think we should undo#181 and work on this at leisure, rather than leaving the current UI in place any longer)

@dummdidumm
Copy link
MemberAuthor

What do you mean bynavigation.type?
(if you're nervous keeping the current state active we can do revert first if you want)

@Rich-Harris
Copy link
Member

InbeforeNavigate andafterNavigate etc —navigation.type should bepopstate but will belinkhttps://kit.svelte.dev/docs/types#public-types-navigationtype. I'll do the revert, then we can figure this stuff out later

@dummdidumm
Copy link
MemberAuthor

Ah I see. We could

  • just not worry about this case in the respective tutorial
  • specifically disable the pushState hack and use pop/push delta commands instead ofgoto for that tutorial
  • disable the pushState hack and use pop/push delta for all tutorials (with the drawback that it pollutes the parent history like before)

I don't think that should hold us back though, since without this feature there wouldn't even be a way to trigger thepopstate navigation type within the iframe.

@brandonmcconnell
Copy link
Contributor

brandonmcconnell commentedFeb 6, 2023
edited
Loading

@dummdidumm@Rich-Harris Another idea could be to allow the iframe state to work naturally until we see some movement onwhatwg/html#6501. That meaning, we could mesh the iframe history with the window's history and have window preserve the iframe state by storing the iframe's current path in a URL param, like…

https://learn.svelte.dev/tutorial/pages?path=/about

That way, it's not so much pollution as it is standard history tracking where there are no redundant polluted entries, but a bunch of unique entries that are all meaningful when they occur.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@dummdidumm@Rich-Harris@brandonmcconnell

[8]ページ先頭

©2009-2025 Movatter.jp