Forum Xamarin Cross Platform with Xamarin

How can we mantain credentials of webview in Mobile and how can we fit View to screen?

I want to call a webview so that it should fit to screen of mobile.After that once if we login we should maintain the credentials of webview in mobile and if we press mobile backbutton then it should go back according to websites only.Is there any solution to solve this issue plz share me the links or related code .Thank You...

Best Answer

  • RafeeqRafeeq USMember ✭✭
    Accepted Answer

    using Xamarin.Forms;

    public class WebViewPage : ContentPage
    {
    private WebView _webView;

    public WebViewPage()
    {
        _webView = new WebView
        {
            HorizontalOptions = LayoutOptions.Fill, 
            VerticalOptions   = LayoutOptions.Fill,
            Source = "http://www.your-url-here.com"
        };
    
        this.Content = _webView;
    }
    
    protected override bool OnBackButtonPressed()
    {
        _webView.GoBack();
    
        return true;
    }
    

    }
    This will set the Mobile backbutton to Website back .

Answers

  • RafeeqRafeeq USMember ✭✭
    Accepted Answer

    using Xamarin.Forms;

    public class WebViewPage : ContentPage
    {
    private WebView _webView;

    public WebViewPage()
    {
        _webView = new WebView
        {
            HorizontalOptions = LayoutOptions.Fill, 
            VerticalOptions   = LayoutOptions.Fill,
            Source = "http://www.your-url-here.com"
        };
    
        this.Content = _webView;
    }
    
    protected override bool OnBackButtonPressed()
    {
        _webView.GoBack();
    
        return true;
    }
    

    }
    This will set the Mobile backbutton to Website back .

  • RafeeqRafeeq USMember ✭✭

    But how can we maintain the Credentials of Webview once we Login in Mobile

Sign In or Register to comment.