Log window.location.replace

I

Ido

Hi,

I'm dealing with a situation that some of the Ads that are running on
my site are doing some 'strange' stuff with redirecting the users.
Since the Ads are coming from Google/Yahoo - I'm tend to belive they
are safe (more or less) but still, I want to check what is going on
with these redirects.
Does any one have a suggestion how to do this logging/tracking of
'window.location.replace' ?
Or even better, do you think, a JS call could control the amounts of
calls that are being made on a specific page?

Thanks,
Ido
 
T

Thomas 'PointedEars' Lahn

Ido said:
I'm dealing with a situation that some of the Ads that are running on
my site are doing some 'strange' stuff with redirecting the users.
Since the Ads are coming from Google/Yahoo - I'm tend to belive they
are safe (more or less) but still, I want to check what is going on
with these redirects.
Does any one have a suggestion how to do this logging/tracking of
'window.location.replace' ?

I doubt that the ads are using `window.location.replace' to begin with.
Redirects can (and should) be facilitated server-side.

However, in your development version, you can try:

var repl = window.location.replace;
var w;
window.location.replace = function(s) {
if (!w)
{
/* add arguments here */
w = window.open("");
if (w)
{
w.document.open("text/html");
}
}

if (w)
{
w.document.write(s + "<br>\n");
}

repl(s);
};

But do not try this in the production version. You have been warned.
Or even better, do you think, a JS call could control the amounts of
calls that are being made on a specific page?

Theoretically, the pattern should facilitate that. However, `window' and
`window.location' are references to host objects, and host objects may have
properties that are read-only or throw an exception on assignment ([[Put]]).


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top