chrome IE浏览器下如何查看cookie,以及简单案例分析

chrome

1、右上角...点击更多工具->开发者工具

2、application->cookies 右侧绿色即为存储的内容。ps:Stroage中local storage session等都是存储数据的不同方式。

ps:Chrome不支持本地使用cookie,Chrome浏览器为了安全只支持online-cookie。也就是,本地不可以设置cookie。只有将项目部署在Server上再从浏览器访问才能使用访问。  例如chrom无法设置cookie内容:页面结果

 

<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title></title>

	</head>
	<body>
		<script type="text/javascript">
			document.cookie = 'name=john';
			document.write(document.cookie);
		</script>
	</body>
</html>

IE浏览器

1、使用开发者工具(按下F12);

2、选择“Console”选项卡,往Console(控制台)输入document.cookie并按下回车键便可查看当前cookie。

案例演示:

<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title></title>

	</head>
	<body>
		<script type="text/javascript">
			document.cookie = 'name=john';
			document.write(document.cookie);
		</script>
	</body>
</html>

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小新空荡荡

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值