Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to reply to JavaScript "wiindow.navigator.appName" in webkit program



On Jun 11, 2004, at 12:06 PM, Chu, Sonny wrote:

I added: [webView setApplicationNameForUserAgent:@"Netscape"]; but it
didn't work. Can anyone tell me what webkit function to call in order to
return a proper value to Javascript's "window.navigator.appName" ?
thanks.

WebCore uses the following rule for what it returns for appName (from Navigator::getValueProperty in kjs_navigator.cpp):


If the user agent string has "Mozilla" in it and does not have "compatible" in it, then use "Netscape".
Otherwise if the user agent string has "Microsoft" in it or has "MSIE" in it, then use "Microsoft Internet Explorer".
Otherwise return an undefined value.


If you don't give a custom user agent string, then you should see "Netscape". I just tested in Safari with:

    javascript:alert(navigator.appName)

and it did indeed show "Netscape".

If you do give a custom user agent string, using the WebView methods that let you customize it, then the rules above will determine what appName will return.

There's currently no Web Kit feature to let you set appName to an arbitrary string. If you'd like one, it would be good to file a bug requesting it at <http://bugreport.apple.com>, and feel free to also post here explaining why it's a good and important feature.

    -- Darin
_______________________________________________
webkitsdk-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webkitsdk-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >how to reply to JavaScript "wiindow.navigator.appName" in webkit program (From: "Chu, Sonny" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.