储存过程调用存储过程_使用HTML5网络存储

储存过程调用存储过程

HTML5 is the biggest buzz word in web development today.  The new features promised by HTML5 will be a huge boost to web developers looking to stop rigging up ways to make their websites better, faster, and more flexible.  One feature that's caught my eye is HTML5's Web Storage.  Web Storage provides a client-side method for saving session information.  Take a look at how Web Storage works!

HTML5是当今Web开发中最大的流行词。 HTML5承诺的新功能将极大地推动Web开发人员的发展,他们希望停止使用各种方法以使其网站变得更好,更快,更灵活。 HTML5的Web存储是吸引我眼球的功能。 Web存储提供了一种用于保存会话信息的客户端方法。 看看Web存储如何工作!

简单的Web存储事实 (Simple Web Storage Facts)

  • Values can be any data type supported by the structured clone algorithm.

    值可以是结构化克隆算法支持的任何数据类型。
  • User agents should not expire data from a browsing context's session storage areas, but may do so when the user requests that such data be deleted, or when the UA detects that it has limited storage space, or for security reasons.

    用户代理不应使来自浏览上下文的会话存储区域的数据过期,但可以在用户请求删除此类数据,UA出于安全原因而检测到它的存储空间有限时这样做。
  • Storage items are available on the entire domain.

    存储项目在整个域中都可用。

HTML5 Web存储方法 (HTML5 Web Storage Methods)

  • setItem(key,value): adds a key/value pair to the sessionStorage object.

    setItem(key,value):将一个键/值对添加到sessionStorage对象。

  • getItem(key): retrieves the value for a given key.

    getItem(key):检索给定键的值。

  • clear(): removes all key/value pairs for the sessionStorage object.

    clear():删除sessionStorage对象的所有键/值对。

  • removeItem(key): removes a key/value pair from the sessionStorage object.

    removeItem(key):从sessionStorage对象中删除键/值对。

  • key(n):retrieves the value for key[n].

    key(n):检索key [n]的值。

设置键/值 (Setting a Key/Value)

There are two different methods for setting information into sessionStorage:

有两种方法可以将信息设置为sessionStorage :


sessionStorage.setItem('someKey','someValue');


...or you could just use the shortcut method:

...或者您可以只使用快捷方式:


sessionStorage.someKey = 'someValue';


获得价值 (Getting a Value)

There are two methods to retrieve a key/value pair as well:

还有两种检索键/值对的方法:


sessionStorage.getItem('someKey'); //returns 'someValue'


...or simply reference the sessionStorage object:

...或简单地引用sessionStorage对象:


sessionStorage.someKey; //returns 'someValue'


删除键/值 (Removing a Key/Value)


sessionStorage.removeItem('someKey'); //returns 'undefined' for someKey


All you need to do is provide the key to the removeItem method.

您需要做的就是提供removeItem方法的密钥。

清理存储 (Clearing Storage)


sessionStorage.clear(); //everything gone!


A simple clear call -- that's it.

一个简单的明确要求-就是这样。

(非常)基本的Web存储用法示例 ((Very) Basic Web Storage Usage Example)


<a href="javascript:;" onClick="if(sessionStorage && sessionStorage.getItem('name')) { alert('Come back soon, ' + sessionStorage.getItem('name')); }">Sign Out</a>


When the user clicks the sign out link, we ask them to come back soon!

当用户单击退出链接时,我们要求他们尽快回来!

浏览器支持... U (Browser Support...Ugh)

Like every other cool feature available today, browser support is a concern.  Internet Explorer did not support Web Storage until IE8 so you will need to create your own sessionStorage object/class (maybe with MooTools or Dojo?) if you want to support earlier IE browsers.

像今天提供的所有其他炫酷功能一样,浏览器支持也是一个问题。 Internet Explorer直到IE8才支持Web存储,因此,如果要支持早期的IE浏览器,则需要创建自己的sessionStorage对象/类(也许使用MooTools或Dojo?)。

HTML5 Web Storage is very simple but very intriguing.  Since HTML5 Web Storage requires JavaScript, you wont want to use this for any mission critical application unless you want to force users to use a browser that supports the feature.

HTML5 Web存储非常简单,但非常有趣。 由于HTML5 Web存储需要JavaScript,因此除非您想强制用户使用支持该功能的浏览器,否则您将不希望将其用于任何关键任务应用程序。

What are your thoughts about HTML5 Web Storage?  Have you used this for any applications yet?

您对HTML5 Web存储有什么想法? 您是否已将此用于任何应用程序?

翻译自: https://davidwalsh.name/html5-storage

储存过程调用存储过程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值