|
|||||||
| Java (NOT JavaScript!) For discussion of the Java programming language as it applies to the Web ( Not JavaScript ). |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Java redirect script
Hi
I found this script: <script language='JAVASCRIPT' type='TEXT/JAVASCRIPT'> <!-- if ((navigator.appName=="Microsoft Internet Explorer") || (navigator.appName=="Netscape")) { if (navigator.appName=="Microsoft Internet Explorer") window.location = "pc/index.htm"; else window.location = "pc/index.htm"; } else window.location = "phone/index.htm"; //--></script> Unfortunately, it's in Javascript and I need it in Java. Does anybody know the Java code for this Javascript code? Thanks |
|
#2
|
||||
|
||||
|
It would look something like this:
Code:
<%
if (request.getHeader("user-agent").indexOf("MSIE") > -1)
response.sendRedirect("pc/index.htm");
else if (request.getHeader("user-agent").indexOf("Firefox") > -1)
response.sendRedirect("pc/index.htm");
else
response.sendRedirect("phone/index.htm");
%>
|
|
#3
|
|||
|
|||
|
It doesn't seem to work, look:
http://www.voordeligewebsites.com/mpoints/ Does anybody know what I am doing wrong? Thanks! |
|
#4
|
||||
|
||||
|
rays suggestion above presumes that you have a server that understands jsp tags and is a servlet container...the above code should work from any web server that supports jsp/servlet technologies.
__________________
Cheers Khalid Message Posting Guidelines In These Forums, Please read these before posting any question. Web site: webapplikations.com Web Resources Page:Web Resources |
|
#5
|
|||
|
|||
|
Quote:
Thanks in advance for your efforts! |
|
#6
|
||||
|
||||
|
try finding out that if your server supports PHP(Iam guessing it does).If it does then post your question in PHP and you will be all set.
__________________
Cheers Khalid Message Posting Guidelines In These Forums, Please read these before posting any question. Web site: webapplikations.com Web Resources Page:Web Resources |
|
#7
|
|||
|
|||
|
Well, the problem is it has to be Java. This is why:
I'm working with a client who's in the UMTS business. I have to create for him two different sites that will be accesible on one domainname. So I have to use a redirect script. The problem is these UMTS phones only support Java and HTML. So I have to use Java to redirect the user to the right website. So, when a PC is visiting the website he will be directed to the big website and when a UMTS phone is visiting the website he will be directed to the small website. So I need a Java applet that sais that when you are visiting the site with the IE or with Netscape you'll go to the big site, otherwise you'll go to the other site. What also would be good is that when you are visiting with a screen resolution less than 640 x 480 you go to the small site and otherwise you go to the bg site. Several days now I'm looking on the internet for the right applet and I could not find it. I promised my client that I would implement such a Java redirect script so I really hope you guys can help me out. Thanks! |
|
#8
|
||||
|
||||
|
you have something against opera?
__________________
- God |
|
#9
|
||||
|
||||
|
Yep. Most of em are in Italian. I'm not fluent in Italian.
|
|
#10
|
||||
|
||||
|
Quote:
|
|
#11
|
|||
|
|||
|
Quote:
|
|
#12
|
||||
|
||||
|
Yea, any JSP should do for that. You can do it with any server-side technology; the ASP or PHP versions would look very little different. It just depends what you've got available on that particular server. Since we're talking Java here that's why I did it with JSP.
Last edited by ray326; 09-29-2004 at 01:07 AM. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|