Hi Kim, Ok, It's work properly
Thanks, Tung -----Original Message----- From: 김병완 [mailto:[email protected]] Sent: Wednesday, October 16, 2013 1:32 PM To: [email protected] Cc: [email protected] Subject: Re: Re: [Tizen Application-dev] how to set User-Agent in Tizen Native Apps Hi~ the WebSetting class is a just simple data class for Setting. so, If you want to change Setting, you should use SetSetting method. I tested with WebViewer sample application as following and it works. void WebViewer::OnForeground(void) { __pWeb->Resume(); WebSetting webSetting = __pWeb->GetSetting(); String userAgent = webSetting.GetUserAgent(); AppLog("[test] original user agent is %ls", userAgent.GetPointer()); userAgent.Append("added string"); webSetting.SetUserAgent(userAgent); __pWeb->SetSetting(webSetting); } void WebViewer::OnBackground(void) { WebSetting webSetting = __pWeb->GetSetting(); String userAgent = webSetting.GetUserAgent(); AppLog("[test] modified user agent is %ls", userAgent.GetPointer()); __pWeb->Pause(); } Thanks, BW Kim, --Living, Loving, Learning From: [email protected] [mailto:application-dev- [email protected]] On Behalf Of Hanchett, Paul Sent: Wednesday, October 16, 2013 2:09 AM To: Tung Nguyen Cc: [email protected] Subject: Re: [Tizen Application-dev] how to set User-Agent in Tizen Native Apps 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: [email protected] ------------------- 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 <[email protected]> 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:[email protected]] Sent: Monday, October 14, 2013 10:46 PM To: Tung Nguyen Cc: [email protected] 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: [email protected] ------------------- 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 <[email protected]> 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 [email protected] https://lists.tizen.org/listinfo/application-dev _______________________________________________ Application-dev mailing list [email protected] https://lists.tizen.org/listinfo/application-dev
