...

View Full Version : redirect with image/cookie load



jargall
01-18-2009, 04:53 AM
I am aware of PHP redirect script such as this one:

<?php
/* Redirect browser */
header("Location: http://theos.in/");
/* Make sure that code below does not get executed when we redirect. */
exit;
?>


But I need a redirect script that will redirect only after an image is loaded.

WHY I need this:
I am trying to use an image pixel to do affiliate tracking and then redirect to a specific page on the advertiser's site (my affiliate link only goes to the advertiser's home page and I am promoting a specific product).

Now that you understand WHY I need this, maybe you have a bright idea or two.

rangana
01-18-2009, 05:03 AM
I don't think PHP could listen if the image has fully loaded. This could be done via Javascript:


<img src="..." alt="..." onload="location.href='http://theos.in/';">

jargall
01-18-2009, 05:15 AM
Thanks for the reply... When I use this code, the image loads but I dont get redirect (in Firefox or IE):


<html><body><script type='text/javascript'>

function Doredirect()
{
window.location = 'LANDINGPAGE.htm';
}

</script>

<img onload='javascript:Doredirect()' src="TRACKING.htm" width="1" height="1" alt=" ">
</body>
</html>

Do you know why I'm not being redirected?

rangana
01-18-2009, 05:20 AM
<img onload='javascript:Doredirect()' src="TRACKING.htm" width="1" height="1" alt=" ">


Do you know why I'm not being redirected?

...that only means the image has not been loaded.

...and I mean image:


<img onload='javascript:Doredirect()' src="TRACKING.htm" width="1" height="1" alt=" ">

jargall
01-18-2009, 05:25 AM
Ah, I see. hmm... Do you think there is a way to make this work? This is what I'm trying to do again:


WHY I need this:
I am trying to use an image pixel to do affiliate tracking and then redirect to a specific page on the advertiser's site (my affiliate link only goes to the advertiser's home page and I am promoting a specific product).

I don't necessarily need the image to load. This was just one way of getting the cookie onto the visitor's computer. Any ideas for a cookie stuff/redirect?

Inigoesdr
01-18-2009, 02:49 PM
Use an onload tag in the <body> to change the location and put your image just after the <body> tag. This is not a server-side issue, so I'm going to move it to the JavaScript forum.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum