Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [Unreleased]

### Fixed
- Blank pages on navigation in the Facebook and Instagram in-app browser on Android. View transitions are now disabled in these in-app browsers ([#30](https://github.com/mage-os/module-theme-optimization/issues/30)).

## [2.3.0] - 2026-05-11

### Added
Expand Down
17 changes: 17 additions & 0 deletions view/base/templates/view-transitions.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ $style = <<<CSS
CSS;
echo $secureRenderer->renderTag('style', [], $style, false);

/*
* The Facebook and Instagram apps on Android ship their own Chromium based WebView, which starts the
* cross-document view transition but never finishes it, so the page stays blank after navigating.
* Inserted after the style above, so it wins and disables the transition in these in-app browsers.
*/
$inAppBrowserScript = <<<JS
(() => {
const userAgent = navigator.userAgent;
if (!/android/i.test(userAgent) || !/FBAN|FBAV|FB_IAB|Instagram/.test(userAgent)) return;

const style = document.createElement('style');
style.textContent = '@view-transition { navigation: none; }';
document.currentScript.after(style);
})();
JS;
echo $secureRenderer->renderTag('script', [], $inAppBrowserScript, false);

if ($viewModel->isEnabledForBfcache() === false) {
$script = <<<JS
window.addEventListener('pagereveal', (e) => {
Expand Down
Loading