| Reply | « Previous Thread | Next Thread » |
|
I've found one undocumented solution for S60 3rd edition here: http://discussion.forum.nokia.com/fo...d.php?t=143035 but it doesn't work on 3.2 devices.
Does anyone know another methods? |
|
What do you need the user agent string for in an application running on the phone? What do you plan to do with the information? Maybe there are other ways to solve your problem, but without knowing what you are trying to accomplish it is hard to say.
|
|
|
|
Browser's user agent field is needed on the server, which can be accessed as with real browser, as with application's custom HTTP request. Of course, it's possible to hard-code it for each device, but what in the case of firmware upgrade? That's why I'm looking for solution how to retrieve user agent at runtime.
|
|
If you need it on the server, then the server will get it in the HTTP_USER-AGENT HTTP variable/header.
Note that it is browser-specific, so if the user uses some other browser (e.g., Opera Mobile, Opera Mini, Skyfire, Netfront) besides the device's built-in browser, you will see a different HTTP_USER-AGENT at your server. And if the phone user is not using a browser at all, but an application that does its own HTTP handling, then the user-agent string/header can be anything the developer wishes it to be. Still, at least I'm not clear why you want to get the user-agent string by software running on the device? What will you do with the string on the device? If you want to identify the device model, then use the platform ID, instead. |
|
I want to send the exact user agent string from my app as a device's browser sends. Of course, it's possible to form it manually, but in my case I need exact the same string as a browser.
|
|
Actually, I've found correct solution. In my case (newest 3.2 devices), browser's HTTP User Agent is located at another key index, in comparison to the link above. So, final code should be like this:
TInt INDEX = 5; // it can be different on each platform/device, check everything from 0 to 14 iRepository = CRepository::NewLC(TUid::Uid(0x101f8731)); TBuf<255> tmp; iRepository->Get(INDEX, tmp); iUserAgent = HBufC8::NewL(tmp.Length()); iUserAgent->Des().Copy(tmp); Thanks to everyone! |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Nokia User Agent Header | rajendrap16 | Browsing and Mark-ups | 17 | 2008-02-24 16:43 |
| modify the user agent on the fly ? | wyzok | Symbian Networking & Messaging | 0 | 2007-03-16 16:56 |
| How to identify a WAP browser / phone - User agent field | frostyfone | Browsing and Mark-ups | 1 | 2001-11-08 15:26 |
| User agent field in Nokia WAP phones | nkn_aikon | Browsing and Mark-ups | 1 | 2001-11-08 15:24 |