用户是否可以禁用html5 sessionStorage? [英] Can user disable html5 sessionStorage?

查看:641
本文介绍了用户是否可以禁用html5 sessionStorage?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户可以禁用HTML5 sessionStorage他可以如何禁用cookie吗?

can user disable the HTML5 sessionStorage just how he can disable cookies?

还是sessionStorage有效到页面刷新?我的意思是会话实际上是什么意思,是页面刷新?

Also is sessionStorage will valid till page refresh? I mean what session actually mean, is it page refresh?

推荐答案

可以禁用HTML5 sessionStorage禁用cookie?

用户可以清除cookie或禁止任何网站为自己设置cookie。每个浏览器都有该选项。

A User can either clear the cookies or Disallow any website from setting the cookie for themselves.Every browser has that option.

举例 - :屏蔽Cookies

我的意思是会话实际意味着什么,是页面刷新吗?

首先,它不是页面刷新

最简单的类比:Session是一个令牌,允许用户访问网络应用的任何区域。这个令牌有效,直到浏览器关闭。当你关闭浏览器时,所有会话数据都将被清除。

Most simple analogy:Session is a token which allows the user to visit any area of a web app.This token is valid untill the browser close.The moment you close the browser all the session data will get cleared.

那么,如果我希望我的数据持续一段时间,请说我想永久(考虑到用户没有清除cookie)存储一些VA lue在我的用户浏览器上。

So what if i want my data to persist a little longer,Say i want permanently(considering that user have not cleared cookies) store some value on my users browser.

本地存储:本地存储允许数据在浏览器关闭之后持续存在。所以当用户回来时,我们可以在我们的应用程序中使用该数据。我们可以设置它的到期时间。我们可以在需要时清除它。

LOCAL STORAGE:Local storage allows the data to persist beyond the browser close.So when the user comes back,we can use that data in our application.We can set the expiry for it.We can clear it when we want.

注意:IE7 +支持SessionStorage和LocalStorage

NOTE:IE7 + support for SessionStorage and LocalStorage

常规cookie存储:这是我们在客户端存储一些数据的好方法。所有浏览器都支持它。但问题是它们提供的空间太少。

Conventional cookie storage:This is our good old way of storing some data on client.All browsers support it.But the problem is they provide too less space.


  • 一个cookie提供4kb空间,每个域都有一个限制为
    大约15-20个饼干。
    LocalStorage和SessionStorage来我们的救援。他们提供了相当好的空间。
    不同的浏览器有不同的容量。

  • A cookie provides 4kb space and for every domain there is a limit of around 15-20 cookies. LocalStorage and SessionStorage comes to our rescue.They provide quite good space. Different browsers have different capacity.

IE(10 mb)...惊喜惊喜

IE(10 mb)...Surprise surprise

Mozzilla(5 mb)

Mozzilla(5 mb)

Chrome(2.5 mb)

Chrome(2.5 mb)

所以,基本上我可以使用localStorage,如果我希望数据在浏览器关闭和SessionStorage之外持续存在,如果我希望数据在浏览器关闭时保持不变。

So,basically i can use localStorage if i want the data to persist beyond browser close and SessionStorage if i want the data to persist with in the browser close.

还有一些js可用..

There are some js availabe also..


  1. jStorage DOCUMENTATION

  2. persist.js 文档

  1. jStorage DOCUMENTATION
  2. persist.js DOCUMENTATION

这篇关于用户是否可以禁用html5 sessionStorage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆