<div dir="ltr"><div class="gmail_default" style="font-size:small">Tung--</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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.  <img src="cid:33F@goomoji.gmail" goomoji="33F" style="margin: 0px 0.2ex; vertical-align: middle;">)</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Paul</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br clear="all">
<div><div dir="ltr"><br>Paul Hanchett<br>-------------------<br>Infotainment Engineer<br>MSX on behalf of Jaguar Land Rover<br>One World Trade Center, 121 Southwest Salmon Street, 11th Floor, Portland, Oregon, 97204 <br><br>
Email: <a href="mailto:phanchet@jaguarlandrover.com" style="color:rgb(17,85,204)" target="_blank">phanchet@jaguarlandrover.com</a><br>-------------------<br><br>Business Details:<br>Jaguar Land Rover Limited<br>Registered Office: Abbey Road, Whitley, Coventry CV3 4LF <div>
Registered in England No: 1672070</div></div></div>
<br><br><div class="gmail_quote">On Mon, Oct 14, 2013 at 9:12 PM, Tung Nguyen <span dir="ltr"><<a href="mailto:nttung@tma.com.vn" target="_blank">nttung@tma.com.vn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi Paul and All,<u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I want to edit user-agent string and show them on <span>webview</span> successful. So I try to write function to do that as below:<u></u><u></u></span></p>
<div class="im"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:10.0pt;font-family:Consolas;color:#7f0055">void</span></b><span style="font-size:10.0pt;font-family:Consolas"> <span>TizenDemoForm</span>::<span><b>LoadUrl</b></span>(</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7f0055">void</span></b><span style="font-size:10.0pt;font-family:Consolas">)</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas">{</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Consolas"><span>    </span><span>Tizen</span>::Base::String <span>url</span>(<span>L<span style="color:#2a00ff">"http</span></span></span><span style="font-size:10.0pt;font-family:Consolas;color:#2a00ff">://<a href="http://dev.bookmo.jp/magastore_api/index/ua" target="_blank">dev.bookmo.jp/magastore_api/index/ua</a>"</span><span style="font-size:10.0pt;font-family:Consolas">);</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"><span>    </span>String <span><span style="background:yellow">userAgent</span></span> = <span>GetUserAgent</span>();</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"><span>    </span><span>AppLog</span>(</span><span style="font-size:10.0pt;font-family:Consolas;color:#2a00ff">"%<span><u>ls</u>"<span style="color:black">,<span style="background:silver">userAgent</span>.GetPointer</span></span></span><span style="font-size:10.0pt;font-family:Consolas">() );</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"><span>    </span><span><span style="background:silver">userAgent</span>.Append</span>(L</span><span style="font-size:10.0pt;font-family:Consolas;color:#2a00ff">" ABCDDDDD"</span><span style="font-size:10.0pt;font-family:Consolas">);</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"><span>    </span><span>AppLog</span>(</span><span style="font-size:10.0pt;font-family:Consolas;color:#2a00ff">"%<span><u>ls</u>"<span style="color:black">,<span style="background:silver">userAgent</span>.GetPointer</span></span></span><span style="font-size:10.0pt;font-family:Consolas">());</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
</div><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"><span>    </span><span>SetUserAgent</span>(<span><span style="background:silver">userAgent</span>.GetPointer</span>());</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"><span>    </span>_web-><span>LoadUrl</span>(<span>url</span>);</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">}</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">// Explain the function </span><span><b><span style="font-size:10.0pt;font-family:Consolas">LoadUrl</span></b></span><b><span style="font-size:10.0pt;font-family:Consolas">:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Step 1: Get User Agent string<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><span>                </span>Code:<span>    </span>…<u></u><u></u></span></p>
<div class="im"><p class="MsoNormal" style="margin-left:.5in;text-indent:.5in;text-autospace:none"><i><span style="font-size:10.0pt;font-family:Consolas;color:#c0504d">String <span>userAgent</span> = <span><span style="background:silver">GetUserAgent</span></span>();<u></u><u></u></span></i></p>
<p class="MsoNormal"><i><span style="font-size:10.0pt;font-family:Consolas;color:#c0504d"><span>    </span><span>          </span><span>AppLog</span>("%<span><u>ls</u>",userAgent.GetPointer</span>() );</span></i><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#c0504d"><u></u><u></u></span></i></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><span>                                </span>…<u></u><u></u></span></p><p class="MsoNormal" style="text-indent:.5in">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Log: 10-15 10:22:43.693 : INFO / <span>TizenDemo</span> ( 2961 : 2961 ) : void <span>TizenDemoForm</span>::<span>LoadUrl</span>()(61) > <b>Mozilla/5.0 (Linux; <span>Tizen</span> 2.2; <span>sdk</span>) <span>AppleWebKit</span>/537.3 (KHTML, like Gecko) Version/2.2 Mobile Safari/537.3</b><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Step 2: Edit User Agent string<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><span>                </span>Code: …<u></u><u></u></span></p><div class="im"><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#c0504d"><span>                                </span></span><span><i><span style="font-size:10.0pt;font-family:Consolas;color:#c0504d;background:silver">userAgent.Append</span></i></span><i><span style="font-size:10.0pt;font-family:Consolas;color:#c0504d;background:silver">(L" ABCDDDDD");</span></i><i><span style="font-size:10.0pt;font-family:Consolas;color:#c0504d"><u></u><u></u></span></i></p>
<p class="MsoNormal"><i><span style="font-size:10.0pt;font-family:Consolas;color:#c0504d"><span>    </span><span>          </span><span>AppLog</span>("%<span><u>ls</u>",userAgent.GetPointer</span>());</span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#c0504d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p></div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><span>                </span>Log: 10-15 10:28:51.749 : INFO / <span>TizenDemo</span> ( 2961 : 2961 ) : void <span>TizenDemoForm</span>::<span>LoadUrl</span>()(63) > Mozilla/5.0 (Linux; <span>Tizen</span> 2.2; <span>sdk</span>) <span>AppleWebKit</span>/537.3 (KHTML, like Gecko) Version/2.2 Mobile Safari/537.3 ABCDDDDD<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Step 3: Set new User Agent string and load it on web view<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><span>                </span>Code …<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><span>                </span></span><i><span style="font-size:10.0pt;font-family:Consolas;color:#c0504d;background:silver"><span>    </span><span>   </span><span>SetUserAgent</span>(<span>userAgent.GetPointer</span>());</span></i><i><span style="font-size:10.0pt;font-family:Consolas;color:#c0504d"><u></u><u></u></span></i></p>
<p class="MsoNormal"><i><span style="font-size:10.0pt;font-family:Consolas;color:#c0504d"><span>    </span><span>          </span>_web-><span>LoadUrl</span>(<span>url</span>);</span></i><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#c0504d"><u></u><u></u></span></i></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><span>                </span>Result: old user agent string is shown on <span>webview</span>: here -> <b>Mozilla/5.0 (Linux; <span>Tizen</span> 2.2; <span>sdk</span>) <span>AppleWebKit</span>/537.3 (KHTML, like Gecko) Version/2.2 Mobile Safari/537.3</b><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This is wrong with my expected result<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">My Expected Result:<span>  </span>A new user agent string must show on <span>webview</span> : here -> <b>Mozilla/5.0 (Linux; <span>Tizen</span> 2.2; <span>sdk</span>) <span>AppleWebKit</span>/537.3 (KHTML, like Gecko) Version/2.2 Mobile Safari/537.3 ABCDDDDD</b><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I don’t know why? <span>SetUserAgent</span> function not work? <span> </span><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Could you please help me about this? <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Tung<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Hanchett, Paul [mailto:<a href="mailto:phanchet@jaguarlandrover.com" target="_blank">phanchet@jaguarlandrover.com</a>] <br>
<b>Sent:</b> Monday, October 14, 2013 10:46 PM<br><b>To:</b> Tung Nguyen<br><b>Cc:</b> <a href="mailto:application-dev@lists.tizen.org" target="_blank">application-dev@lists.tizen.org</a><br><b>Subject:</b> Re: [Tizen Application-dev] how to set User-Agent in Tizen Native Apps<u></u><u></u></span></p>
</div><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">It might be useful if you tell us, "<i>How</i> does it not work?"  -- Gives error?  No effect?  If you immediately try to retrieve the value after setting it, what do you get?<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Paul<u></u><u></u></p></div></div><div><p class="MsoNormal"><br clear="all"><u></u><u></u></p><div><div><p class="MsoNormal"><br>Paul Hanchett<br>
-------------------<br>Infotainment Engineer<br>MSX on behalf of Jaguar Land Rover<br>One World Trade Center, 121 Southwest Salmon Street, 11th Floor, Portland, Oregon, 97204 <br><br>Email: <a href="mailto:phanchet@jaguarlandrover.com" target="_blank"><span style="color:#1155cc">phanchet@jaguarlandrover.com</span></a><br>
-------------------<br><br>Business Details:<br>Jaguar Land Rover Limited<br>Registered Office: Abbey Road, Whitley, Coventry CV3 4LF <u></u><u></u></p><div><p class="MsoNormal">Registered in England No: 1672070<u></u><u></u></p>
</div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p><div><p class="MsoNormal">On Mon, Oct 14, 2013 at 3:45 AM, Tung Nguyen <<a href="mailto:nttung@tma.com.vn" target="_blank">nttung@tma.com.vn</a>> wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal">Hi All,<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">I have write function to change value user agent, but setuserAgent function not work<u></u><u></u></p><p class="MsoNormal">
 <u></u><u></u></p><p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:10.0pt;font-family:Consolas;color:#7f0055">void</span></b><span style="font-size:10.0pt;font-family:Consolas"> TizenDemoForm::<b>LoadUrl</b>(<b><span style="color:#7f0055">void</span></b>)</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas">{</span><u></u><u></u></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas">    Tizen::Base::String url(L<span style="color:#2a00ff">"<a href="http://dev.bookmo.jp/magastore_api/index/ua" target="_blank">http://dev.bookmo.jp/magastore_api/index/ua</a>"</span>);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas">    String <span style="background:yellow">userAgent</span> = GetUserAgent();</span><u></u><u></u></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Consolas">    AppLog(<span style="color:#2a00ff">"%<u>ls</u>"</span>,<span style="background:silver">userAgent</span>.GetPointer() );</span><u></u><u></u></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Consolas">    <span style="background:silver">userAgent</span>.Append(L<span style="color:#2a00ff">" ABCDDDDD"</span>);</span><u></u><u></u></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Consolas">    AppLog(<span style="color:#2a00ff">"%<u>ls</u>"</span>,<span style="background:silver">userAgent</span>.GetPointer() );</span><u></u><u></u></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Consolas">    <span style="color:red">SetUserAgent(<span style="background:yellow">userAgent</span>);</span></span><u></u><u></u></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Consolas">    _web->LoadUrl(url);</span><u></u><u></u></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">}</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">Please help me about this?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">Thanks,</span><u></u><u></u></p><p class="MsoNormal">
<span style="font-size:10.0pt;font-family:Consolas">Tung</span><u></u><u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>Application-dev mailing list<br>
<a href="mailto:Application-dev@lists.tizen.org" target="_blank">Application-dev@lists.tizen.org</a><br><a href="https://lists.tizen.org/listinfo/application-dev" target="_blank">https://lists.tizen.org/listinfo/application-dev</a><u></u><u></u></p>
</div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></blockquote></div><br></div>