G
G
germn2012-08-12 13:09:33
JavaScript
germn, 2012-08-12 13:09:33

Is it possible to set cookies for the domain from which the .js file is loaded?

On the site-A.ru site pages, I load the file.js script located on the site-B.ru

site-A.ru/page1.htm site :

<script type="text/javascript" src="http://site-B.ru/file.js"></script>


If I try to set cookies inside the site-B.ru/file.js script , they will be set to site-A.ru

Can I set cookies for the site-B.ru domain inside the site-B.ru/file.js script ? Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nazar Mokrinsky, 2012-08-12
@germn

Only if they are both subdomains of the same domain, then you can set the cookie for the higher order domain.

S
Sirian, 2012-08-12
@Sirian

from file.js you can create a hidden iframe with a page on the site-B.ru site, inside which you can set cookies

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question