最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Way to remove localstorage created by JavaScript in C# - Stack Overflow

programmeradmin4浏览0评论

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.

Share Improve this question edited Jun 13, 2013 at 11:59 asked Jun 13, 2013 at 11:28 user2189143user2189143 2
  • 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
Add a ment  | 

1 Answer 1

Reset to default 6

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

发布评论

评论列表(0)

  1. 暂无评论