Browser like an Iphone

studio4

Member
Licensed User
Longtime User
Good morning. Firstly, excuses because my English skill is not good, due to I am Spanish.

I am desperate: I need that the default web browser of android simulates to be an iphone, So, I can show my web page correctly (my web page contains a video and the web view does not show videos). I have tried to create a webview and to change the property “setuseragentstring “and it works well, but this property only changes in the webview and it does not change in the default browser of android:

Example:

Sub globals------------------------
Dim WebViewSetting1 As WebViewSettings
Dim WebViewExtras1 As WebViewExtras
End sub
----------------------
Sub activity_Create
WebViewExtras1.addJavascriptInterface(w, "B4A")
WebViewSetting1.setJavaScriptCanOpenWindowsAutomatically(w,True)
WebViewExtras1.addWebChromeClient(w)
w.ZoomEnabled=False
WebViewSetting1.setUserAgentString(w, "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7")

End sub
-----------------------

It changes the webview properties but it does not change the default browser of android. I know that if you write in the address bar (of default browser)…. About:debug, I can change this property in the settings of the browser directly, but I need making it in my application.

Someone knows something? I cannot advance in my project without overcoming this step. Thank you very much.
 

Inman

Well-Known Member
Licensed User
Longtime User
I think it will be easier to modify your web page so that if the user-agent string is equivalent to Android, then show the iPhone version of the page.

Or create a new web page on your server (like www.mysite.com/mobile) such that it always shows the iPhone version, regardless of the browser the visitor uses. And then use that web page's url in your application.
 
Upvote 0

studio4

Member
Licensed User
Longtime User
The web page is not mine

Firstly, thank you for you early answer. It is very easy, but the web page is not mine, so, I can not modify it. I need another ideas. Thank you.
 
Upvote 0
Top