You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Mast <jh...@gmail.com> on 2009/03/02 21:22:56 UTC

[OT] Using jsp/serlvets to track clicking

[Sorry for this non-Tomcat specific question, but Sun Forums didn't help me
much with this one]

I would like to know how to imitate the click of link in JSP or serlvet, in
order to track clicks.

I have pages with links containing tel protocol URIs like this:
Click <a href="tel:5555555555">here</a> to listen!

I want to replace the above with something like this:
Click <a href="call_tracking.jsp?pn=5555555555">here</a> to listen!

And have call_tracking.jsp do its tracking stuff and then spawn a phone
call, just like the first example does. I do not want to bother the user
with another page, hence the need to accomplish the click action
programmatically. I presume this feat is achievable via Response header
magic, I just don't know the right incantation ;-)

I should add that this is not necessarily a TEL-specific question, I am
looking for a generic, protocol-independent mechanism for mimicking a
"click".

Thanks

Re: [OT] Using jsp/serlvets to track clicking

Posted by Ken Bowen <kb...@als.com>.
I see your problem.  However, I do believe that most of the recent  
smart phones support javascript, including basic Ajax.
Definitely iPhone/iTouch, and I believe the T1 too.  I'm not sure  
about the most recent Blackberries and Nokias (but it's
something I need to find out).

I guess it would depend on exactly what your market covers.

--Ken

On Mar 2, 2009, at 5:18 PM, Jonathan Mast wrote:

> Thanks Ken, the problem with this solution is that these pages are for
> viewing on mobile phones, most of which do not have JavaScript  
> capability.
>
> What I had in mind was akin to what I do on regular website when I  
> want a
> link to generate a file that is saved to disk (an excel report app,  
> for
> instance).  In this case, I set the Content-Disposition: to file or  
> whatever
> by calling method in the response object.
>
> There must be something similar that can make the browser behave  
> like it has
> just clicked a regular TEL:NNNNNNNNNN link.
>
> On Mon, Mar 2, 2009 at 4:00 PM, Ken Bowen <kb...@als.com> wrote:
>
>> Well, a very generic way of getting a hold of a "click"  in the  
>> kind of
>> setting you're describing
>> would be to an an "onclick" to the link, invoking some Javascript  
>> doing
>> whatever you want.
>> Maybe something like   <a href="tel:5555555555
>> onclick="myCalltrackingCode();">here</a> to listen!
>> Almost all html entities support onclick.
>>
>> --Ken
>>
>>
>> On Mar 2, 2009, at 3:22 PM, Jonathan Mast wrote:
>>
>> [Sorry for this non-Tomcat specific question, but Sun Forums didn't  
>> help
>>> me
>>> much with this one]
>>>
>>> I would like to know how to imitate the click of link in JSP or  
>>> serlvet,
>>> in
>>> order to track clicks.
>>>
>>> I have pages with links containing tel protocol URIs like this:
>>> Click <a href="tel:5555555555">here</a> to listen!
>>>
>>> I want to replace the above with something like this:
>>> Click <a href="call_tracking.jsp?pn=5555555555">here</a> to listen!
>>>
>>> And have call_tracking.jsp do its tracking stuff and then spawn a  
>>> phone
>>> call, just like the first example does. I do not want to bother  
>>> the user
>>> with another page, hence the need to accomplish the click action
>>> programmatically. I presume this feat is achievable via Response  
>>> header
>>> magic, I just don't know the right incantation ;-)
>>>
>>> I should add that this is not necessarily a TEL-specific question,  
>>> I am
>>> looking for a generic, protocol-independent mechanism for  
>>> mimicking a
>>> "click".
>>>
>>> Thanks
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] Using jsp/serlvets to track clicking

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan,

On 3/2/2009 5:18 PM, Jonathan Mast wrote:
> Thanks Ken, the problem with this solution is that these pages are for
> viewing on mobile phones, most of which do not have JavaScript capability.
> 
> What I had in mind was akin to what I do on regular website when I want a
> link to generate a file that is saved to disk (an excel report app, for
> instance).  In this case, I set the Content-Disposition: to file or whatever
> by calling method in the response object.

Note that a full roundtrip happens in the above case: a regular HTTP
request is sent to the server, and a full response is sent. The fact
that the browser responds by saving the file and NOT refreshing the page
is client-specirfic.

> There must be something similar that can make the browser behave like it has
> just clicked a regular TEL:NNNNNNNNNN link.

What about accepting the request and responding with a REDIRECT to a
tel:// URL? That would be the first thing I try.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmsXocACgkQ9CaO5/Lv0PCsCwCeMWIIe4RR1R4dDKAFwoDWqnTk
7fcAmQExGYVPkSGuZyT1tkbaE8lzbxma
=0qLl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [OT] Using jsp/serlvets to track clicking

Posted by Martin Gainty <mg...@hotmail.com>.
which versions of Microsoft Mobile or Blackberry?

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> Date: Mon, 2 Mar 2009 17:18:09 -0500
> Subject: Re: [OT] Using jsp/serlvets to track clicking
> From: jhmast.developer@gmail.com
> To: users@tomcat.apache.org
> 
> Thanks Ken, the problem with this solution is that these pages are for
> viewing on mobile phones, most of which do not have JavaScript capability.
> 
> What I had in mind was akin to what I do on regular website when I want a
> link to generate a file that is saved to disk (an excel report app, for
> instance).  In this case, I set the Content-Disposition: to file or whatever
> by calling method in the response object.
> 
> There must be something similar that can make the browser behave like it has
> just clicked a regular TEL:NNNNNNNNNN link.
> 
> On Mon, Mar 2, 2009 at 4:00 PM, Ken Bowen <kb...@als.com> wrote:
> 
> > Well, a very generic way of getting a hold of a "click"  in the kind of
> > setting you're describing
> > would be to an an "onclick" to the link, invoking some Javascript doing
> > whatever you want.
> > Maybe something like   <a href="tel:5555555555
> > onclick="myCalltrackingCode();">here</a> to listen!
> > Almost all html entities support onclick.
> >
> > --Ken
> >
> >
> > On Mar 2, 2009, at 3:22 PM, Jonathan Mast wrote:
> >
> >  [Sorry for this non-Tomcat specific question, but Sun Forums didn't help
> >> me
> >> much with this one]
> >>
> >> I would like to know how to imitate the click of link in JSP or serlvet,
> >> in
> >> order to track clicks.
> >>
> >> I have pages with links containing tel protocol URIs like this:
> >> Click <a href="tel:5555555555">here</a> to listen!
> >>
> >> I want to replace the above with something like this:
> >> Click <a href="call_tracking.jsp?pn=5555555555">here</a> to listen!
> >>
> >> And have call_tracking.jsp do its tracking stuff and then spawn a phone
> >> call, just like the first example does. I do not want to bother the user
> >> with another page, hence the need to accomplish the click action
> >> programmatically. I presume this feat is achievable via Response header
> >> magic, I just don't know the right incantation ;-)
> >>
> >> I should add that this is not necessarily a TEL-specific question, I am
> >> looking for a generic, protocol-independent mechanism for mimicking a
> >> "click".
> >>
> >> Thanks
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >

_________________________________________________________________
Windows Liveā„¢ Contacts: Organize your contact list. 
http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009

Re: [OT] Using jsp/serlvets to track clicking

Posted by Jonathan Mast <jh...@gmail.com>.
Thanks Ken, the problem with this solution is that these pages are for
viewing on mobile phones, most of which do not have JavaScript capability.

What I had in mind was akin to what I do on regular website when I want a
link to generate a file that is saved to disk (an excel report app, for
instance).  In this case, I set the Content-Disposition: to file or whatever
by calling method in the response object.

There must be something similar that can make the browser behave like it has
just clicked a regular TEL:NNNNNNNNNN link.

On Mon, Mar 2, 2009 at 4:00 PM, Ken Bowen <kb...@als.com> wrote:

> Well, a very generic way of getting a hold of a "click"  in the kind of
> setting you're describing
> would be to an an "onclick" to the link, invoking some Javascript doing
> whatever you want.
> Maybe something like   <a href="tel:5555555555
> onclick="myCalltrackingCode();">here</a> to listen!
> Almost all html entities support onclick.
>
> --Ken
>
>
> On Mar 2, 2009, at 3:22 PM, Jonathan Mast wrote:
>
>  [Sorry for this non-Tomcat specific question, but Sun Forums didn't help
>> me
>> much with this one]
>>
>> I would like to know how to imitate the click of link in JSP or serlvet,
>> in
>> order to track clicks.
>>
>> I have pages with links containing tel protocol URIs like this:
>> Click <a href="tel:5555555555">here</a> to listen!
>>
>> I want to replace the above with something like this:
>> Click <a href="call_tracking.jsp?pn=5555555555">here</a> to listen!
>>
>> And have call_tracking.jsp do its tracking stuff and then spawn a phone
>> call, just like the first example does. I do not want to bother the user
>> with another page, hence the need to accomplish the click action
>> programmatically. I presume this feat is achievable via Response header
>> magic, I just don't know the right incantation ;-)
>>
>> I should add that this is not necessarily a TEL-specific question, I am
>> looking for a generic, protocol-independent mechanism for mimicking a
>> "click".
>>
>> Thanks
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: [OT] Using jsp/serlvets to track clicking

Posted by Ken Bowen <kb...@als.com>.
Well, a very generic way of getting a hold of a "click"  in the kind  
of setting you're describing
would be to an an "onclick" to the link, invoking some Javascript  
doing whatever you want.
Maybe something like   <a href="tel:5555555555  
onclick="myCalltrackingCode();">here</a> to listen!
Almost all html entities support onclick.

--Ken

On Mar 2, 2009, at 3:22 PM, Jonathan Mast wrote:

> [Sorry for this non-Tomcat specific question, but Sun Forums didn't  
> help me
> much with this one]
>
> I would like to know how to imitate the click of link in JSP or  
> serlvet, in
> order to track clicks.
>
> I have pages with links containing tel protocol URIs like this:
> Click <a href="tel:5555555555">here</a> to listen!
>
> I want to replace the above with something like this:
> Click <a href="call_tracking.jsp?pn=5555555555">here</a> to listen!
>
> And have call_tracking.jsp do its tracking stuff and then spawn a  
> phone
> call, just like the first example does. I do not want to bother the  
> user
> with another page, hence the need to accomplish the click action
> programmatically. I presume this feat is achievable via Response  
> header
> magic, I just don't know the right incantation ;-)
>
> I should add that this is not necessarily a TEL-specific question, I  
> am
> looking for a generic, protocol-independent mechanism for mimicking a
> "click".
>
> Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] Using jsp/serlvets to track clicking

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan,

On 3/3/2009 5:46 PM, Jonathan Mast wrote:
> Also, I tried the response.sendRedirect("tel:555555555"); approach
> recommended by Christopher and that resulted in a MalFormed URL error on the
> phone.

Hmm... are you sure that the "tel:" prefix is really a supported
protocol by the phone? Or does the browser do some hand-wavy magic that
makes the link /look/ like it's a supported protocol.

If it's the latter, javascript may be your only choice. :(

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmtuKsACgkQ9CaO5/Lv0PBAewCfUJsk0a2CqDvBgVZQzJhXzeCp
AVsAnAj7H/LUzX8Up+Cm4X/In/UDZjv/
=YnZu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] Using jsp/serlvets to track clicking

Posted by Jonathan Mast <jh...@gmail.com>.
Will doing such make the user-agent behave like it has just clicked a link?

Also, I tried the response.sendRedirect("tel:555555555"); approach
recommended by Christopher and that resulted in a MalFormed URL error on the
phone.

thanks

On Tue, Mar 3, 2009 at 1:56 PM, Juha Laiho <Ju...@iki.fi> wrote:

> Jonathan Mast wrote:
> > I would like to know how to imitate the click of link in JSP or serlvet,
> in
> > order to track clicks.
> >
> > I have pages with links containing tel protocol URIs like this:
> > Click <a href="tel:5555555555">here</a> to listen!
> >
> > I want to replace the above with something like this:
> > Click <a href="call_tracking.jsp?pn=5555555555">here</a> to listen!
> >
> > And have call_tracking.jsp do its tracking stuff and then spawn a phone
> > call, just like the first example does.
>
> That looks like your jsp should return a HTTP 303 "See Other" redirect
> status
> with the desired 'tel:xxx' URL as the redirect target (or, HTTP 302 "Found"
> for compatibility). Please see
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3
> for details.
> --
> ..Juha
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: [OT] Using jsp/serlvets to track clicking

Posted by Juha Laiho <Ju...@iki.fi>.
Jonathan Mast wrote:
> I would like to know how to imitate the click of link in JSP or serlvet, in
> order to track clicks.
> 
> I have pages with links containing tel protocol URIs like this:
> Click <a href="tel:5555555555">here</a> to listen!
> 
> I want to replace the above with something like this:
> Click <a href="call_tracking.jsp?pn=5555555555">here</a> to listen!
> 
> And have call_tracking.jsp do its tracking stuff and then spawn a phone
> call, just like the first example does.

That looks like your jsp should return a HTTP 303 "See Other" redirect status
with the desired 'tel:xxx' URL as the redirect target (or, HTTP 302 "Found"
for compatibility). Please see
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3
for details.
-- 
..Juha

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org