premise: under the domain name ".myweb.com", there are two sites A (a.myweb.com) and B (b.myweb.com), and single sign-on can be performed between the two sites. The logic of single sign-on is that when a user visits any page under a certain site, the cookie, that determines whether there is session information under the current site or not visits the Login site (login.myweb.com), the cookie, that determines whether there is session information in the Login site is redirected to the login page, and if so, it jumps to the page before the judgment is executed. When a user logs in at a site, the cookie of the current session information is stored in the current site and in the Login site. The logic of single sign-on can no longer be modified for objective reasons.
problem: the content of an iframe,iframe in site An is a page of site B, but the redirection in single sign-on uses window.top, so it will cause the entire page to jump to site B, so you want to set the cookie of the session information of site A to site B before iframe renders the page of site B, so that you can not visit the Login site and trigger the redirection.
I"m using the jq.cookie plug-in, but in actual development, executing the following code in site A doesn"t work. By consulting the data, it should be caused by the cross-domain setting of cookie. Is there any solution?
$.cookie("_serviceId","f850...", { domain: ".b.myweb.com",path: "/"});