Table of Contents
回复内容:
6 个回答
Home Backend Development PHP Tutorial javascript - cookie可不可以设置成不往服务器发送啊? - SegmentFault

javascript - cookie可不可以设置成不往服务器发送啊? - SegmentFault

Jun 06, 2016 pm 05:27 PM
javascript php

在网站开发中经常要用到一些个性化设置,需要用到cookie记录信息,但是发现cookie信息很大,每次请求都要往服务器发送,感觉没必要,因为这些信息是不需要服务器来处理的,所以感觉很浪费资源,没必要每次请求往服务器发那么多信息。

有没有办法可以设置一种只在浏览器上面用,但是不会往服务器上面发送的cookie啊?

回复内容:

在网站开发中经常要用到一些个性化设置,需要用到cookie记录信息,但是发现cookie信息很大,每次请求都要往服务器发送,感觉没必要,因为这些信息是不需要服务器来处理的,所以感觉很浪费资源,没必要每次请求往服务器发那么多信息。

有没有办法可以设置一种只在浏览器上面用,但是不会往服务器上面发送的cookie啊?

  • 6 小时前提问
  • 评论
  • 邀请回答

请先 登录 后评论

默认排序 时间排序

6 个回答

1

采纳

应该不行吧,所以才会有 cookie-free 的说法

只在客户端使用,可以用 localStorage/useData 吧

用本地存储呗,自己搜索js本地存储就行了,不需要用cookie

你说的东西叫 localStorage 和 sessionStorage。

浏览器可以禁用cookie

h5的本地存储机制可以实现

不存在 cookie 里面不就行了。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

CakePHP Date and Time

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

CakePHP Project Configuration

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

CakePHP File upload

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

CakePHP Routing

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

Discuss CakePHP

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP Quick Guide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

How To Set Up Visual Studio Code (VS Code) for PHP Development

See all articles