From: Dave K. <dko...@ve...> - 2005-04-30 00:22:58
|
To followup my own message, I have determined that, in the scenario below, in most places in the code, the browser version is correctly transmitted as specified in the call to WebClient. However, in the code that handles javascript, specifically in Navigator.java, the value for userAgent as returned by jsGet_userAgent() is always "Mozilla/4.0 (compatible; MSIE 6.0b Windows98)" regardless of what it should be set to. As the above string is the default setting for BrowserVersion, I'd have to guess that Navigator.java is not referencing the BrowserVersion as set in WebClient() Dave At 01:21 PM 4/29/2005, Dave Kosenko wrote: >Ok, after more complete investigation, I must retract my statement that >there is a problem with >when the onload() function is being invoked in HTMLUnit. > >However, I think I have found another problem that was actually making it >look as though onload >was the problem. It appears that the problem lies with WebClient. In my >java program, I set up >a BrowserVersion to emulate Firefox: > >BrowserVersion bv; >... >bv = new BrowserVersion("Netscape", "5.0 (Windows; en-US)", "Mozilla/5.0 >(Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 >Firefox/1.0.3", "1.2"); >... >WebClient webClient = new WebClient(bv,); > >In the javascript brought into the page, I added an alert to tell me what >it thought the browser version >is (in the full code, this is critical, since it takes different actions >based on the type of browser): > >function DetectBrowser() { > alert(navigator.appName); > alert(navigator.appVersion); > alert(navigator.userAgent); > alert(navigator.appCodeName); > alert(navigator.platorm); >... >} > >And I get the following when I run the program: > >WARNING: window.alert("Microsoft Internet Explorer") no handler installed >WARNING: window.alert("4.0 (compatible; MSIE 6.0b; Windows98)") no handler >installed >WARNING: window.alert("Mozilla/4.0 (compatible; MSIE 6.0b; Windows98)") no >handler installed >WARNING: window.alert("Mozilla") no handler installed >WARNING: window.alert("Win32") no handler installed > >So either I am doing something very wrong, or my BrowserVersion is being >completely ignored. I also >tried using the various pre-defined BrowserVersion values in the >BrowserVersion class, all with the same >result. |