Being sure an image loads before redirection..... - نوشته شده در (941 Views)
Senior Member
bobby131313
مطلب: 1163
1163

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!<
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Average Member
SiSL
مطلب: 671
671
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 %>>
<
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
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
%>
<
نوشته شده در
Senior Member
bobby131313
مطلب: 1163
1163
Thanks Guys!
I will play with these suggestions today and see what I can do.<
 
شما باید یک متن وارد کنید