Hello, I'm new to JavaScripting and have a question that should be simple (I think). I want a frame that stays constant and checks the URL of a second frame constantly. When ever the URL of frame2 changes frame one catches the new URL and saves it to a VAR. I think that is should be possible and I think that Javascript would be a good way of doing this. Please let me know if this is possible or if Javascript would not be the best route. Thanks
I don't think Javascript allows a frame to access the content of another frame, unless both are from the same domain. This should work if they are from the same domain. // Set this to false, if you want only unique URLs to be added to the var var uniqueURL = true; var arURL = new Array(); var lastURL = '', curURL = ''; function storeURL(){ //In case this doesn't work, replace frames[1] with frames["second_frame_name"] curURL = window.parent.frames[1].location.href; if(curURL != lastURL){ var isUnique = true; if(uniqueURL){ for(var i in arURL){ if(arURL[i] == curURL){ isUnique = false; break; } } } if(isUnique){ lastURL = curURL; arURL[arURL.length] = lastURL; alert(arURL); } } setTimeout('storeURL()', 1000); } PHP: Call this function on the onload event of your first frame.