如何在javascript中从另一个跨域url读取cookie

时间:2022-08-23 10:02:23

I have a cross domain url in which if I access directly, I can see cookies(from Resources->Cookies in chrome browser).

我有一个跨域URL,如果我直接访问,我可以看到cookie(来自Resources-> Cookies在chrome浏览器中)。

I have created a separate HTML file in which whenever the HTML file page loads, I need to get the cookie from that url.

我创建了一个单独的HTML文件,每当HTML文件页面加载时,我需要从该URL获取cookie。

Is it possible through javascript?

可以通过JavaScript吗?

1 个解决方案

#1


4  

You can not read the cookies from cross domain url, unless the website has explicitly allowed it. (that is very rare)

除非网站明确允许,否则您无法从跨域网址读取Cookie。 (这是非常罕见的)

Generally You can not do it.

一般你不能这样做。

#1


4  

You can not read the cookies from cross domain url, unless the website has explicitly allowed it. (that is very rare)

除非网站明确允许,否则您无法从跨域网址读取Cookie。 (这是非常罕见的)

Generally You can not do it.

一般你不能这样做。