Forum Xamarin Xamarin.Forms

Getting error “SecurityError (DOM Exception 18): The operation is insecure” when storing data in web

PavanParekhPavanParekh USMember ✭✭
edited April 2017 in Xamarin.Forms

I am developing one sample Xamarin.Forms Application and in this application I'm using WebView for tyro payment gateway integration and also create WebViewRenderer for store data in localStorage of UIWebView. and I'm getting security error (SecurityError (DOM Exception 18): The operation is insecure). Tyro payment gateway web url is "https://iclient.test.tyro.com".

Please have a look below my code and help me

string subkey = "window.localStorage.setItem('webTta.integrationKey','integrationKey')";
string key ="try { "+subkey +"; } catch (e) { alert(e); }";
IntegrationKey = _uiWebView.EvaluateJavascript(key);

Best Answer

  • PavanParekhPavanParekh USMember ✭✭
    Accepted Answer

    My issue is solved.
    This error was occurring by storing data before loading page.
    I solved this issue by call EvaluateJavascript method after loading a page.
    If you try to call an EvaluateJavascript method in blank WebView then it is also occurring.

Answers

  • PavanParekhPavanParekh USMember ✭✭
    Accepted Answer

    My issue is solved.
    This error was occurring by storing data before loading page.
    I solved this issue by call EvaluateJavascript method after loading a page.
    If you try to call an EvaluateJavascript method in blank WebView then it is also occurring.

Sign In or Register to comment.