Being sure an image loads before redirection.....

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/68052?pagenum=1
05 November 2025, 11:08

Topic


bobby131313
Being sure an image loads before redirection.....
05 January 2009, 21:15



I have built a redirection page for some of my affiliate stuff to make it easier to code and track clicks. The code in the file is like this.....
Code:

<img src="http://c.statcounter.com/3850509/0/3927c8de/1/">
<%
if Request.QueryString("target") <> "" then
Dim target
target = Server.URLEncode(Right(Request.QueryString,Len(Request.QueryString)-7))
Response.Redirect ("http://affiliate.somesite.com/entry.asp?" & target)

else
Response.Write "You have reached this page in error!"

end if
%>

I pass the url to it in the query string and it works like a charm.
The problem is the StatCounter pixel never fires before the redirection. Is there any solution for this?
Thanks!<

 

Replies ...


SiSL
06 January 2009, 00:34


Because you can't control client side load with ASP and ASP redirections.
You have to use Javascript instead like

<img src="imageurl" onload="this.location.href='urltogo';" />

in your case...

Code:
<%
if Request.QueryString("target") <> "" then
Dim target
target = Server.URLEncode(Right(Request.QueryString,Len(Request.QueryString)-7))
additionalJS = "onload='document.location.href='http://affiliate.somesite.com/entry.asp?" & target & "';"""
else
additionalJS = ""
Response.Write "You have reached this page in error!"
end if
%>

<img src="http://c.statcounter.com/3850509/0/3927c8de/1/" <%= additionalJS %>>
<
Carefree
06 January 2009, 00:36


You could try something like this:

Code:

<img src="http://c.statcounter.com/3850509/0/3927c8de/1/">
<%
if Request.QueryString("target") <> "" then
Dim target
target = Server.URLEncode(Right(Request.QueryString,Len (Request.QueryString)-7))
id=SetTimeOut("EPA",30,"VBScript")
else
Response.Write "You have reached this page in error!"
end if

sub EPA
window.location="http://affiliate.somesite.com/entry.asp?" & target
end sub
%>
<
bobby131313
06 January 2009, 09:39


Thanks Guys!
I will play with these suggestions today and see what I can do.<
© 2000-2021 Snitz™ Communications