emin Posted May 22, 2022 Share Posted May 22, 2022 Hi Cookie value can be retrieved from same domain using this code, but I need to get cookie values from another domain. Since my app will serve as a subdomain and when the app is created I have to pick the same language as the main domain by getting the language cookies of the main domain. Quote UniApplication.Cookies.Values['xxx']; Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 22, 2022 Share Posted May 22, 2022 3 hours ago, emin said: Hi Cookie value can be retrieved from same domain using this code, but I need to get cookie values from another domain. Since my app will serve as a subdomain and when the app is created I have to pick the same language as the main domain by getting the language cookies of the main domain. Hello, try to use java script to get cookie: https://www.w3schools.blog/get-cookie-by-name-javascript-js UNiSession.AddJS ( 'function getCookie(cookieName) { let cookie = {}; document.cookie.split('';'').forEach(function(el) { let [key,value] = el.split(''=''); cookie[key.trim()] = value; }) return cookie[cookieName]; };' alert (getCookie ('wanted cookie name')) ); Quote Link to comment Share on other sites More sharing options...
emin Posted May 22, 2022 Author Share Posted May 22, 2022 I could not find how to enter different domain parameters in this script. For example, how can I get the value of the "ct_timezone" cookie in the domain https://www.w3schools.blog Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 22, 2022 Share Posted May 22, 2022 23 minutes ago, emin said: I could not find how to enter different domain parameters in this script. For example, how can I get the value of the "ct_timezone" cookie in the domain https://www.w3schools.blog You can show cookie with javascript in URL of browser like this: javascript:alert(document.cookie); but: "You cannot get cookies from another site; you can only give own cookies to another site. document.cookie contains semicolon-separated list of name=vale of the cookies of your own page; you can use that to pass to another site using XHR" from here:https://stackoverflow.com/questions/26178322/how-to-get-cookie-value-using-url https://stackoverflow.com/questions/36318866/reading-a-cookie-from-a-different-domain https://stackoverflow.com/questions/3342140/cross-domain-cookies Quote Link to comment Share on other sites More sharing options...
emin Posted May 22, 2022 Author Share Posted May 22, 2022 Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.