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

Tung Nguyen nttung at tma.com.vn
Tue Oct 15 04:12:00 GMT 2013


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:  <mailto:phanchet at jaguarlandrover.com> 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/3166938f/attachment-0001.html>


More information about the Application-dev mailing list