Click to See Complete Forum and Search --> : How to detect/handle events from other sites


JetDeveloper
May 12th, 2005, 02:07 PM
I would like to make a frameset in which the left frame keeps a history of all the sites you visit in the right frame.

For example, if I load http://www.yahoo.com in the right frame and then someone clicks a link in yahoo.com that has

<a href="someurl" target="_top">

I would like to detect the click on the link so that I can prevent it from loading in the _top page and destrying my frameset.

I also need to know how to detect when the right frame's URL changes and have it work for any place on the Internet, not just within my Web application.

Is there any way to do this in ASP.NET or ASP? Javascript gives me permission denied for any url outside the server.

Thanks in advance.

jamessadlier
May 17th, 2005, 06:37 AM
I can't think of any way to do it using .NET, but you could use a Javascript timer to continually read the right-frame's location and add it to a history array contained in the left hand side DOM.

Something like...


function checkRHS_URL()
{
var url = new String(document.getElementById("RHSFrame").location.href;
if(!AlreadyInHistoryArray())
{
AddToArray();
}

setTimeout("checkRHS_URL()", 100);
}


It's a bit of a hack but it'll check your URLs 10 times a second.
setTimeout("checkRHS_URL()", 100);

JetDeveloper
May 17th, 2005, 12:31 PM
I can't think of any way to do it using .NET, but you could use a Javascript timer to continually read the right-frame's location and add it to a history array contained in the left hand side DOM.

Something like...


function checkRHS_URL()
{
var url = new String(document.getElementById("RHSFrame").location.href;
if(!AlreadyInHistoryArray())
{
AddToArray();
}

setTimeout("checkRHS_URL()", 100);
}


It's a bit of a hack but it'll check your URLs 10 times a second.
setTimeout("checkRHS_URL()", 100);

That's what I'm doing now, but if the URL of the right frame is on a different server than the one the ASP.NET application is running on, I get a 'permission denied' error for the URL and the Javascript timer will crash.