javascript - Set cookie while loading remote js in the domain where js is hosted -


below scenario looking at:

  1. i remotely loading js file site hello.com.
  2. the js loaded jsfoo.com.
  3. i want set cookie domain jsfoo.com in users browser when user visiting hello.com?

is possible within js file loaded or have write server side logic when loading js?

the objective retarget user visited hello.com when user vists jsfoo.com later.

update based on comment below: possible if js loaded dynamically? example if load js via dynamic url jsfoo.com/getjs.php?js=sample.js. wouldn't possible code set , cookies jsfoo.com via php code?

the js code executed under domain, can not set cookie client-side. possible if script resource loaded other domain sets cookie domain via http response header.

and won’t able access cookie of jsfoo.com in hello.com. if need existing value, script on jsfoo needs read when request domain happens, , return value in way js can read (f.e. outputting js variable.)


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -