I am developing Windows phone 7.1 PhoneGap app. I would like to remove localstorage which was created by window.localStorage.setItem
JavaScript code in C#. I know, in JavaScript we can remove using window.localStorage.removeItem
. But, I want to remove from code behind C#. Any help is appreciated.
I am developing Windows phone 7.1 PhoneGap app. I would like to remove localstorage which was created by window.localStorage.setItem
JavaScript code in C#. I know, in JavaScript we can remove using window.localStorage.removeItem
. But, I want to remove from code behind C#. Any help is appreciated.
- Are you using a WebBrowser control? stackoverflow./questions/153748/… – sq33G Commented Jun 13, 2013 at 12:00
- I tried WebBrowser, But some unknown error occurs with exception. – user2189143 Commented Jun 13, 2013 at 12:03
1 Answer
Reset to default 6Use this code,
ScriptManager.RegisterStartupScript(this, GetType(), "YourUniqueScriptKey",
"localStorage.removeItem(key);", true);
note: local storage is a client side and C# is serverside. so simple you cannot access client side items with c#. but in above code it will run a javascript code in the first page load after your c# event.