C
C#2y ago
khamas

MAUI Webview target=_blank href redirects not working on android

I have an MAUI app that is essentially a WebView that hosts a wordpress website. My problem is that whenever I try to load an external link it will simply not load the "href" redirect... It works fine on Windows and iOS devices, but not in android. EDIT: The href is a "_blank" target. Is there a specific permission I need in the manifest? In case it helps, here is the code for the page:
<?xml version="1.0" encoding="utf-8" ?>

<Grid BackgroundColor="DarkSlateGrey">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackLayout Grid.Row="0" Grid.Column="0"
Spacing="5" Orientation="Horizontal" Padding="8">
<Button Text="Go Back" TextColor="DarkSlateGray" BackgroundColor="White"/>
<Button Text="Change Language" x:Name="ChangeLangBtn" TextColor="DarkSlateGray" BackgroundColor="White"/>
</StackLayout>
<WebView Grid.Row="1" Grid.Column="0"
Source="https://example.com"
x:Name="WebView"/>
</Grid>
<?xml version="1.0" encoding="utf-8" ?>

<Grid BackgroundColor="DarkSlateGrey">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackLayout Grid.Row="0" Grid.Column="0"
Spacing="5" Orientation="Horizontal" Padding="8">
<Button Text="Go Back" TextColor="DarkSlateGray" BackgroundColor="White"/>
<Button Text="Change Language" x:Name="ChangeLangBtn" TextColor="DarkSlateGray" BackgroundColor="White"/>
</StackLayout>
<WebView Grid.Row="1" Grid.Column="0"
Source="https://example.com"
x:Name="WebView"/>
</Grid>
And here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="2" android:versionName="2">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true" android:label="MYAPPNAME"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="2" android:versionName="2">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true" android:label="MYAPPNAME"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
</manifest>
0 Replies
No replies yetBe the first to reply to this messageJoin