Back/forward cache in extension options page

48 views
Skip to first unread message

Jeff Johnson

unread,
Jan 18, 2024, 7:37:18 AM1/18/24
to Chromium Extensions
The main options page of my chrome extension has links to several other extension pages, and each sub-page has a back button with the action window.history.back(). However, when I go back, the main options page is reloaded entirely, and the scroll position is lost. This is unlike Safari, for example, where the main options is cached. Is there any way to make Chrome put the options page in the back/forward cache too?

wOxxOm

unread,
Jan 18, 2024, 9:15:21 AM1/18/24
to Chromium Extensions, Jeff Johnson
bfcache is not supported for chrome-extension:// scheme in Chrome currently. Probably intentionally, but I think this is wrong because extension pages despite being local can still contain complex state when navigating to another web site or another page inside the extension.

It may be a bug too, so if you can attach a demo extension consider reporting it in https://crbug.com.

A workaround may be to show those pages in a named iframe stretched to the entire document and specify that name as target=name attribute in the link tag. Another one, in case you use the embedded options, to use "open_in_tab": true.

Jeff Johnson

unread,
Jan 18, 2024, 11:35:11 AM1/18/24
to Chromium Extensions
> On Jan 18, 2024, at 8:15 AM, wOxxOm <wox...@gmail.com> wrote:
>
> bfcache is not supported for chrome-extension:// scheme in Chrome currently. Probably intentionally, but I think this is wrong because extension pages despite being local can still contain complex state when navigating to another web site or another page inside the extension.
>
> It may be a bug too, so if you can attach a demo extension consider reporting it in https://crbug.com.

Done: https://bugs.chromium.org/p/chromium/issues/detail?id=1519538


> A workaround may be to show those pages in a named iframe stretched to the entire document and specify that name as target=name attribute in the link tag. Another one, in case you use the embedded options, to use "open_in_tab": true.

Thanks! Although the iframe workaround would quite inconvenient and unpleasant for a number of reasons.

By the way, it appears that Firefox also uses the bfcache for extension pages as well as Safari, so Chrome is the outlier.
Reply all
Reply to author
Forward
0 new messages