使用 javascript 使用两个不同的域设置和读取 cookie [英] Set and read cookies using two different domain using javascript

查看:62
本文介绍了使用 javascript 使用两个不同的域设置和读取 cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 javascript[document.cookie] 在 url 中设置 cookie,例如 salesforce apex 页面 url,并在同一浏览器的另一个域中获取这些 cookie.使用 javacript 但无法获取.

I want to set cookies in url like salesforce apex page url using javascript[document.cookie] and get those cookies in another domain in same browser.using javacript but not able to get.

实际上是我在 iframe 中加载的 Apex 页面,那次我设置了该 cookie 并将这些 cookie 放到了 salesforce 域之外的另一个页面中.

Actually my Apex page which i load in iframe and that time i set that cookies and get those cookies in another page which is out side of salesforce domain.

任何机构都知道如何使用不同的域设置和获取 cookie.

Any body have any idea how to set and get cookies using different domains.

推荐答案

出于安全原因,无法读取其他域创建的 cookie.我也相信浏览器会处理 cookie 域方面的创建,所以我认为不可能从"另一个域创建 cookie.

It isn't possible to read cookies created by another domain for security reasons. I also believe the browser handles the creation of the domain aspect of the cookie, so I don't believe it's possible to create a cookie "from" another domain.

我认为您要问的问题在单独的域上是不可能的(子域可以工作)

I don't think what you're asking is possible on separate domains (sub-domains would work)

这篇关于使用 javascript 使用两个不同的域设置和读取 cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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