[Tizen Application-dev] how to set User-Agent in Tizen Native Apps

Hanchett, Paul phanchet at jaguarlandrover.com
Tue Oct 15 17:08:51 GMT 2013


Tung--

Forgive me, I haven't used this API.  But it seems to me that this API is
returning a String that tells you what the user agent is, not a handle to a
userAgent.  If that were true, when you do the append() it just adds to the
returned string, wouldn't change the agent string.

You might try SetUserAgent("New Agent") followed by a GetAgent() call and
see what that does.  (If there are name space issues, sorry I don't know
how to resolve them at this point.  [?])

Paul



Paul Hanchett
-------------------
Infotainment Engineer
MSX on behalf of Jaguar Land Rover
One World Trade Center, 121 Southwest Salmon Street, 11th Floor, Portland,
Oregon, 97204

Email: phanchet at jaguarlandrover.com
-------------------

Business Details:
Jaguar Land Rover Limited
Registered Office: Abbey Road, Whitley, Coventry CV3 4LF
Registered in England No: 1672070


On Mon, Oct 14, 2013 at 9:12 PM, Tung Nguyen <nttung at tma.com.vn> wrote:

> Hi Paul and All,****
>
> ** **
>
> I want to edit user-agent string and show them on webview successful. So
> I try to write function to do that as below:****
>
> ** **
>
> *void* TizenDemoForm::*LoadUrl*(*void*)****
>
> {****
>
>     Tizen::Base::String url(L"http://dev.bookmo.jp/magastore_api/index/ua"
> );****
>
>     String userAgent = GetUserAgent();****
>
>     AppLog("%*ls*",userAgent.GetPointer() );****
>
>     userAgent.Append(L" ABCDDDDD");****
>
>     AppLog("%*ls*",userAgent.GetPointer());****
>
>     SetUserAgent(userAgent.GetPointer());****
>
>     _web->LoadUrl(url);****
>
> ** **
>
> }****
>
> ** **
>
> // Explain the function *LoadUrl**:*****
>
> ** **
>
> Step 1: Get User Agent string****
>
>                 Code:    …****
>
> *String userAgent = GetUserAgent();*
>
> *              AppLog("%ls",userAgent.GetPointer() );***
>
>                                 …****
>
> Log: 10-15 10:22:43.693 : INFO / TizenDemo ( 2961 : 2961 ) : void
> TizenDemoForm::LoadUrl()(61) > *Mozilla/5.0 (Linux; Tizen 2.2; sdk)
> AppleWebKit/537.3 (KHTML, like Gecko) Version/2.2 Mobile Safari/537.3*****
>
> ** **
>
> Step 2: Edit User Agent string****
>
>                 Code: …****
>
>                                 *userAgent.Append**(L" ABCDDDDD");***
>
> *              AppLog("%ls",userAgent.GetPointer());*****
>
> ** **
>
>                 Log: 10-15 10:28:51.749 : INFO / TizenDemo ( 2961 : 2961
> ) : void TizenDemoForm::LoadUrl()(63) > Mozilla/5.0 (Linux; Tizen 2.2; sdk)
> AppleWebKit/537.3 (KHTML, like Gecko) Version/2.2 Mobile Safari/537.3
> ABCDDDDD****
>
> ** **
>
> Step 3: Set new User Agent string and load it on web view****
>
>                 Code …****
>
>                 *       SetUserAgent(userAgent.GetPointer());***
>
> *              _web->LoadUrl(url);***
>
> ** **
>
>                 Result: old user agent string is shown on webview: here
> -> *Mozilla/5.0 (Linux; Tizen 2.2; sdk) AppleWebKit/537.3 (KHTML, like
> Gecko) Version/2.2 Mobile Safari/537.3*****
>
> This is wrong with my expected result****
>
> ** **
>
> My Expected Result:  A new user agent string must show on webview : here
> -> *Mozilla/5.0 (Linux; Tizen 2.2; sdk) AppleWebKit/537.3 (KHTML, like
> Gecko) Version/2.2 Mobile Safari/537.3 ABCDDDDD*****
>
> ** **
>
> I don’t know why? SetUserAgent function not work?  ****
>
> ** **
>
> Could you please help me about this? ****
>
> ** **
>
> Thanks,****
>
> Tung****
>
> ** **
>
> ** **
>
> *From:* Hanchett, Paul [mailto:phanchet at jaguarlandrover.com]
> *Sent:* Monday, October 14, 2013 10:46 PM
> *To:* Tung Nguyen
> *Cc:* application-dev at lists.tizen.org
> *Subject:* Re: [Tizen Application-dev] how to set User-Agent in Tizen
> Native Apps****
>
> ** **
>
> It might be useful if you tell us, "*How* does it not work?"  -- Gives
> error?  No effect?  If you immediately try to retrieve the value after
> setting it, what do you get?****
>
> ** **
>
> Paul****
>
>
> ****
>
>
> Paul Hanchett
> -------------------
> Infotainment Engineer
> MSX on behalf of Jaguar Land Rover
> One World Trade Center, 121 Southwest Salmon Street, 11th Floor, Portland,
> Oregon, 97204
>
> Email: phanchet at jaguarlandrover.com
> -------------------
>
> Business Details:
> Jaguar Land Rover Limited
> Registered Office: Abbey Road, Whitley, Coventry CV3 4LF ****
>
> Registered in England No: 1672070****
>
> ** **
>
> On Mon, Oct 14, 2013 at 3:45 AM, Tung Nguyen <nttung at tma.com.vn> wrote:***
> *
>
> Hi All,****
>
>  ****
>
> I have write function to change value user agent, but setuserAgent
> function not work****
>
>  ****
>
> *void* TizenDemoForm::*LoadUrl*(*void*)****
>
> {****
>
>     Tizen::Base::String url(L"http://dev.bookmo.jp/magastore_api/index/ua"
> );****
>
>     String userAgent = GetUserAgent();****
>
>     AppLog("%*ls*",userAgent.GetPointer() );****
>
>     userAgent.Append(L" ABCDDDDD");****
>
>     AppLog("%*ls*",userAgent.GetPointer() );****
>
>     SetUserAgent(userAgent);****
>
>     _web->LoadUrl(url);****
>
>  ****
>
>  ****
>
> }****
>
>  ****
>
> Please help me about this?****
>
>  ****
>
> Thanks,****
>
> Tung****
>
>
> _______________________________________________
> Application-dev mailing list
> Application-dev at lists.tizen.org
> https://lists.tizen.org/listinfo/application-dev****
>
> ** **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tizen.org/pipermail/application-dev/attachments/20131015/2f8837a7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 33F.gif
Type: image/gif
Size: 100 bytes
Desc: not available
URL: <http://lists.tizen.org/pipermail/application-dev/attachments/20131015/2f8837a7/attachment-0001.gif>


More information about the Application-dev mailing list