Detect browser name [message #485579] |
Wed, 08 December 2010 23:02 |
havok
Messages: 36 Registered: February 2010
|
Member |
|
|
Hi!
I need to define the type of user's web-browser (Opera, Ie, chrome, firefox), under which launched forms.
Tell me, please, how I do it.
|
|
|
|
|
Re: Detect browser name [message #489535 is a reply to message #485784] |
Mon, 17 January 2011 06:47 |
havok
Messages: 36 Registered: February 2010
|
Member |
|
|
The question remains open.
I need to determine the browser in an open form in which it is running.
1) The first option to use JavaScript before launch the form.
<HTML>
<script type="text/javascript">
var nav_name = navigator.appName + " " + navigator.appVersion;
var url = "http://machine:8889/forms/frmservlet?config=myconfig&form=test.fmx&otherparams=BROWSER="+nav_name;
window.location.href = url ;
</script>
<BODY>
</BODY>
</HTML>
Then just add a BROWSER parameter to your starting form.
It is work. I can use 'User-Agent' instead of 'navigator.appName'.
But this way does not meet the requirements. The form is opened not from JavaScript, but specific method.
2) The stcond way is use HTTP Header information from within Forms.
Then I misunderstood.
I created a file
<HTML>
<BODY>
<%
out.println ("Remote address =" + request.getRemoteAddr ());
out.println ("Browser_info =" + request.getHeader ("user-agent"));
%>
</ BODY>
</ HTML>
I connect to it using the Java-bean
String url_address = "http://172.16.1.204:8889/j2ee/remoteIP.jsp";
try
{
URL url = new URL(url_address);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
boolean flag_is_Browser = true;
for(int i=0; i<100 && flag_is_Browser; i++)
{
line = rd.readLine();
System.out.println("line: " + line);
****************************************************
Remote adres it defines true. But the user-agent " Mozilla/4.0 (Windows 7 6.1) Java/1.6.0_22 ". And no information about the browser
I also try to connect to the file through 'Utl_Http' in forms
url := 'http://172.16.1.204:8889/j2ee/remoteIP.jsp';
utl_http.set_detailed_excp_support(enable => TRUE);
req := Utl_Http.Begin_Request ( url => url, method => 'GET' );
UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/4.0');
resp := Utl_Http.Get_Response ( r => req );
f_out:=Client_Text_IO.Fopen('C:\a.txt', 'w');
Utl_Http.Read_Text ( r => resp, data => v_msg );
Client_Text_IO.Put_Line(f_out, v_msg);
Client_Text_IO.Fclose(f_out);
Utl_Http.End_Response ( r => resp );
In this case, the user-agent is not defined (null)
Help please. Give specific and detailed response is desirable, how can I determine browser????
|
|
|