diff --git a/lib/view/widget/player_embed.dart b/lib/view/widget/player_embed.dart index b46cd206..023a6a3c 100644 --- a/lib/view/widget/player_embed.dart +++ b/lib/view/widget/player_embed.dart @@ -32,14 +32,18 @@ class PlayerEmbed extends ConsumerWidget { ), initialUrlRequest: URLRequest(url: WebUri.uri(replacedUrl)), shouldOverrideUrlLoading: (controller, navigationAction) async { + final url = navigationAction.request.url; if (navigationAction.hasGesture ?? false) { - final url = navigationAction.request.url; if (url != null) { await launchUrl(ref, url); return NavigationActionPolicy.CANCEL; } } - return NavigationActionPolicy.ALLOW; + if (url?.normalizePath() == replacedUrl.normalizePath()) { + return NavigationActionPolicy.ALLOW; + } else { + return NavigationActionPolicy.CANCEL; + } }, ); diff --git a/lib/view/widget/twitter_embed.dart b/lib/view/widget/twitter_embed.dart index cf9a1435..55746eb8 100644 --- a/lib/view/widget/twitter_embed.dart +++ b/lib/view/widget/twitter_embed.dart @@ -73,9 +73,7 @@ class TwitterEmbed extends HookConsumerWidget { height: height.value, child: InAppWebView( initialSettings: InAppWebViewSettings(transparentBackground: true), - initialUrlRequest: URLRequest( - url: WebUri.uri(Uri.dataFromString(content, mimeType: 'text/html')), - ), + initialData: InAppWebViewInitialData(data: content), onWebViewCreated: (controller) => controller.addJavaScriptHandler( handlerName: 'onReady', callback: (arguments) =>