Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to pass browser type while using URLConnection.

 
Sam Tom
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am tring to access a web page. However, this page is having a javascript which checks for browser type whethere it is IE or netscape and if it is neither of these two it will redirect to a different page. Since I am tring to access for a regular java program, I can only read the redirected page. My problem is how to set that the I am accessing throgh IE.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using setRequestProperty to create headers. Each name & value pair you set turns into one header. You might like to have an HTTP sniffer like Fiddler around to observe the headers going back & forth in normal conversations. That will make it easier to build your own headers to impersonate a regular browser.

Fiddler
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, any luck with that? Or with changing your name?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!