• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to know whether the browser is IE or netscape

 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Jsp How to know whether the browser is IE or netscape orsomething else.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the user-agent header.
bear
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
user agent header means??? where to find that
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
You can go to,
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
and look at the User-Agent request header returned by the browser in the HttpServletRequest object, which is accessible to JSPs via inbuilt object named- request.
Please try go google on User-Agent format to see how to really detect the browser from that string...
Regards
Maulin
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot....
if i am running on IE request.getHeader("User-Agent") returns
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
And in netscape am getting
Mozilla/4.7 [en] (WinNT; I).
Now How to compare This and take a decision.should we check the whole string and accordingly do the operation???smallconfussion....
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai,
by using this u can know what browser the client is using-
window.navigator.appName. this returns the name of the browser.

jyothsna
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
where we have to call this window.navigator.appName what is the Syntax for that.
 
jyothsna kumari
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai,
u can call this function and see.
<SCRIPT LANGUAGE="JavaScript">
function aaa() {
alert(window.navigator.appName);
}
</script>
in the alert box u get the type of browser.
jyothsna
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the very fast response......but i have to use the same in jsp.so how to use in jsp
 
jyothsna kumari
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
place the above code before the body tag of a jsp page
and call the function on onload of the body tag.
tried to paste the code but some error is commimg.
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried that onLoad of the page......It is giving Exact Result.But i have use same functionality using java,jsp
 
jyothsna kumari
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
u want the browser type in u'r java class?
if yes then u can get the type from jsp page
and set in a session variable and pass it to u'r
java class.
if no,then pls give me some details so that i may
help u.
jyothsna
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jyothsana.......Now how to call window.open() for netscape.
This is working with IE but not with Netscape...
window.open("browsertest.jsp","","alwaysRaised=yes,dependent=yes,height=200,width=300,menubar=no,resize=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

this works in netscape and in explorer.
// Mathias
reply
    Bookmark Topic Watch Topic
  • New Topic