How to redirect the user

D

diego.manilla

Hi. I've got a problem with long URL's. I'm developing a web app
specifically for mobile devices. The problem is that I must redirect
the user to some other site and some of these little bastards have a
URL length limit (such as the Motorola V300, which has a limit of 100
characters), yet the URL has 200+ characters. I'm currently using
response.sendRedirect on a servlet.

I can use a java.net.URL object to do the request and send it to the
user, but the redirection needed isn't happening.

I suppose that a POST form instead of a redirection could work, but
that solution would involve some nasty java-scripting to send the form
automatically, with the parameters placed on hidden fields.

Any idea on how to solve this without ugly javascript and such?

Thanks in advance.
 
O

Oliver Wong

Hi. I've got a problem with long URL's. I'm developing a web app
specifically for mobile devices. The problem is that I must redirect
the user to some other site and some of these little bastards have a
URL length limit (such as the Motorola V300, which has a limit of 100
characters), yet the URL has 200+ characters. I'm currently using
response.sendRedirect on a servlet.

I can use a java.net.URL object to do the request and send it to the
user, but the redirection needed isn't happening.

I suppose that a POST form instead of a redirection could work, but
that solution would involve some nasty java-scripting to send the form
automatically, with the parameters placed on hidden fields.

Any idea on how to solve this without ugly javascript and such?

Redirect to http://tinyurl.com/u ?

- Oliver
 
R

Real Gagnon

I suppose that a POST form instead of a redirection could work, but
that solution would involve some nasty java-scripting to send the form
automatically, with the parameters placed on hidden fields.

Any idea on how to solve this without ugly javascript and such?

<BODY onLoad="document.myform.submit();"> is not that ugly ?

Bye.
 
D

diego.manilla

Real said:
<BODY onLoad="document.myform.submit();"> is not that ugly ?

Well, the problem is that the device might not even support Javascript
(and we must server also WML pages for older devices, and maybe there's
no equivalent for that in WMLScript).

Oliver: I thought of that possibility, too, but the URL is dynamic and
I suppose tinyurl performs a redirection, anyway.

Well, I think this is a problem with no solution other than shorten the
URL (not possible at this moment) or the form/javascript hack, but just
in case someone knows a magical solution...

Thanks both for your replies
 
C

Chris Uppal

Hi. I've got a problem with long URL's. I'm developing a web app
specifically for mobile devices. The problem is that I must redirect
the user to some other site and some of these little bastards have a
URL length limit (such as the Motorola V300, which has a limit of 100
characters), yet the URL has 200+ characters. I'm currently using
response.sendRedirect on a servlet.

If you expect the client device to connect to a webserver using an URL which is
longer than the client device supports then you are clearly hosed. It's
nothing to do with redirects, etc, but that the HTTP stack in the device is
unable to issue the relevant request.

So you have four possible approaches.

a) Give up. Just accept that some devices can't access some websites.
b) Somehow induce the operators of the other website to shorted their URLs.
c) Spoof their web content -- i.e. create a website which (at server-side)
pulls the data off their site and re-issues it under an accesible name. You
may have licensing issues.
d) Create your own HTTP stack on the client device which is not limited in this
way (I presume that would be infeasible for your purposes, but just for
completeness...).

-- chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top