Bug 55247 - Getting error “SecurityError (DOM Exception 18): The operation is insecure” when storing data in localStorage of UIWebView
Summary: Getting error “SecurityError (DOM Exception 18): The operation is insecure” w...
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.4
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-04-17 04:47 UTC by Pavan Parekh
Modified: 2017-04-17 23:47 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Here i am attached ipad screen shots for reference, Please have a look: (126.54 KB, image/png)
2017-04-17 04:47 UTC, Pavan Parekh

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Pavan Parekh 2017-04-17 04:47:23 UTC
Created attachment 21565 [details]
Here i am attached ipad screen shots for reference, Please have a look:

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 asap.

string subkey = "window.localStorage.setItem('webTta.integrationKey','integrationKey')";
string key ="try { "+subkey +"; } catch (e) {  alert(e);  }";
IntegrationKey = _uiWebView.EvaluateJavascript(key);
Comment 1 Jimmy [MSFT] 2017-04-17 23:47:34 UTC
Looking online at other references to this error message indicates that this is an issue with WebViews and a security policy:

- https://github.com/i18next/i18next-browser-languageDetector/issues/132
- https://github.com/angular-translate/angular-translate/issues/629
- http://stackoverflow.com/questions/13348766/securityerror-the-operation-is-insecure-window-history-pushstate

As this does not appear to be a bug or issue with Xamarin Forms, I am closing this report. For API usage and implementation questions we recommend posting a question on Stack Overflow under the 'xamarin' tag so you can reach the broader Xamarin and C# community.