user2141754
user2141754

Reputation:

Windows Phone 8 Web Browser control not working

I am trying to navigate to a URL but the web browser control either shows blank page or shows page cannot be found error. Here is my code:

Private Sub qwb_Loaded(sender As Object, e As RoutedEventArgs) Handles qwb.Loaded
    NavigationContext.QueryString.TryGetValue("url", url)
    Dim urltonav = New Uri(url, UriKind.RelativeOrAbsolute)
    qwb.Navigate(urltonav)
End Sub

PS: The URL is http://www.mobile.quora.com. Loading the page under Page1_Loaded event also doesn't work.

This is the XAML code of the page which has the web browser control:

<phone:PhoneApplicationPage
    x:Class="MyApp.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True">

       <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

               <StackPanel Grid.Row="0" Margin="12,17,0,28"/>
        <phone:WebBrowser x:Name="qwb" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.RowSpan="2" Height="768" Width="480" IsScriptEnabled="True"/>

         </Grid>

</phone:PhoneApplicationPage>

I am trying to run the app on device not emulator with working WiFi. OS version is Windows Phone 8 and I have Visual Studio 2012. I don't think theres a problem with network. I have even tried to use .Source property instead of Navigate but it doesn't work also.

Upvotes: 0

Views: 2210

Answers (2)

Parth Mehta
Parth Mehta

Reputation: 87

Are you able to display your url?

  • if it is html page then you should keep it in side your solution's folder and write

    WebBrowser1.Navigate(new Uri("ch51130.html", UriKind.Relative));

  • if it is simple url like www.google.com then

    Uri uri = new Uri("http://www.google.co.in");

Upvotes: 0

Patrick F
Patrick F

Reputation: 1201

You probably meant to access http://mobile.quora.com (without the www)

Upvotes: 1

Related Questions