cookies为本地HTML文件保存在哪里? [英] Where are cookies saved for a local HTML file?

查看:113
本文介绍了cookies为本地HTML文件保存在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在桌面上创建了一个HTML文件,并添加了一些JavaScript来设置和清除cookie。

现在我的问题是,Cookie是否会保存在我的浏览器中?我可以阅读吗?



如果是,




  • 哪个域名可以保存?


  • 我如何在Google Chrome浏览器中看到它? (在Chrome上运行HTML)


解决方案

不从本地网页存储cookies:


Firefox有很棒的功能



目的你可以设置一个开发域如localhost或myfakedomain.com,并在本地服务器上运行您的文件。



搜索:


  • 编辑主机文件[操作系统]

  • [操作系统]上的本地服务器(我使用xampp)
>

I created an HTML file on my desktop and added some JavaScript to set and clear cookies.

Now my question is, will the cookie be saved in my browser? Can I read it back?

if Yes,

  • For which domain will it be saved?

  • How can I see it in Google Chrome? (HTML run on Chrome)

解决方案

Unfortunately some browsers including Google Chrome do not store cookies from local web pages:

Firefox has great developer plugins for cookie management, which report their domains, access paths and expiry:

For local development purposes you can setup a development domain like "localhost" or "myfakedomain.com" and run your files on a local server.

Search:

  • Editing Hosts File [operating system]
  • Setup Local server on [operating system] (I use xampp)

这篇关于cookies为本地HTML文件保存在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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