B
Ben Amada
Hi ...
I have an HTML page containing a bunch of <a> links. Some of the links
redirect the visitor to a page at a different website in a new browser
window (target=_blank) and other links are "mailto" links.
What I want to do is record a little information when they click on a link
(mainly which link they are clicking on). I can put together a server side
webpage that can receive this information and store it in a DB. I'm just
not sure what JavaScript function I would call to "hit" that page. The page
would not be visible. I'm fairly certain AJAX or an iframe would work --
even though I have limited experience with these two techniques. Here's an
example of what I'm looking to do:
<a href="http://www.example.com/"
target="_blank"
onclick="doTracker('example.com');">
Visit this Site
</a>
<a href="mailto:[email protected]"
onclick="doTracker('(e-mail address removed)');">
Email someone
</a>
The doTracker() function would just do two things
1. somehow hit my tracking page (maybe using querystring variables).
2. return true at the end so the link will be executed.
I can pass the information on the link the visitor clicked on via
querystring variables (this seems simplest to do).
My question is, how can I open or hit my tracking page "behind the scenes"?
AJAX, iframe, or something else?
Thanks in advance,
Ben
I have an HTML page containing a bunch of <a> links. Some of the links
redirect the visitor to a page at a different website in a new browser
window (target=_blank) and other links are "mailto" links.
What I want to do is record a little information when they click on a link
(mainly which link they are clicking on). I can put together a server side
webpage that can receive this information and store it in a DB. I'm just
not sure what JavaScript function I would call to "hit" that page. The page
would not be visible. I'm fairly certain AJAX or an iframe would work --
even though I have limited experience with these two techniques. Here's an
example of what I'm looking to do:
<a href="http://www.example.com/"
target="_blank"
onclick="doTracker('example.com');">
Visit this Site
</a>
<a href="mailto:[email protected]"
onclick="doTracker('(e-mail address removed)');">
Email someone
</a>
The doTracker() function would just do two things
1. somehow hit my tracking page (maybe using querystring variables).
2. return true at the end so the link will be executed.
I can pass the information on the link the visitor clicked on via
querystring variables (this seems simplest to do).
My question is, how can I open or hit my tracking page "behind the scenes"?
AJAX, iframe, or something else?
Thanks in advance,
Ben