Accessing cookies set in php by javascript

just to check, this javascript:

function runOnLoad() {
	alert( document.cookie );
}

window.onload=runOnLoad;

would output any cookie data visible to the page which runs that js right? and the cookies which will be visible are relative the the page’s address, not the address of the js file right? just trying to work out why i’m not able to access a cookie set by php with js. thanks.

> would output any cookie data visible to the page which runs that js right?

the answer’s yes. thanks.

How is the PHP cookie being set? If the $path parameter is not set, cookies will only be accessible if you’re in the same directory path.

yup, that’s what it was – the path. got it now. thanks.