views:

115

answers:

2

How is it possible to set the user agent header sent by SWT Browser?
edit: Or is there any browser lib for java that allows specifying the user agent?

+1  A: 

Not a GUI browser, but Jakarta Commons HttpClient allows you to specify the user-agent.

http://www.manticmoo.com/articles/jeff/programming/java/setting-user-agent-in-jakarta-httpclient.php

Noel M
It would be OK if it accepted cookies automatically for each site.
János Harsányi
It does - http://hc.apache.org/httpclient-3.x/cookies.html
Noel M
A: 

This Stack Overflow question lists of browser components for Swing that you could use instead: http://stackoverflow.com/questions/145863/best-java-swing-browser-component

A number of them are open source and written in Java, so you could pick one of those and change the user agent header in the source code of your chosen component.

gutch