PDA

View Full Version : Tracking window.open location



Falkon303
10-10-2008, 02:42 AM
Ok,

so let's say I have the following javascript window.open set.


window.open ("http://www.wtfe.com", "mywindow","status=1,width=350,height=150");

Now, I have given this window the id of "mywindow", but the question is, can the http location be tracked through the window id?

Scenario: A user goes from one of my pages opened via javascript to another site, can I know which location they are visiting?

If so, this present some interesting options for keyword research, but also secutiry issues as well. It seems to me like it is possible though.

rangana
10-10-2008, 02:52 AM
<script type="text/javascript">
window.onload=function(){
document.getElementById('test').onclick=function()
{
var winObj=window.open('http://www.google.com','mywin','height=300,width=300');
alert(winObj.name);
return false; // Cancel any event from this point foward
}
}
</script>
<a href="#" id="test">Test</a>

Falkon303
10-10-2008, 03:04 AM
<script type="text/javascript">
window.onload=function(){
document.getElementById('test').onclick=function()
{
var winObj=window.open('http://www.google.com','mywin','height=300,width=300');
alert(winObj.name);
return false; // Cancel any event from this point foward
}
}
</script>
<a href="#" id="test">Test</a>


This shows the name of the window in firefox, but the url (location.href) is display as about:blank. I am not sure that communication of document.window is allowed at all. The closest I have found for cross domain scripting is use of fragment identifiers.

example - http://www.tagneto.org/blogcode/xframe/ui2.html

this is also a very nice example - http://www.tagneto.org/blogcode/xframe/ui.html#pipeMessage_1223608221578