webview internet explorer android 4.4

caillaud

Member
Licensed User
Longtime User
on an android 4.4 pad (tablette)
is it possible with a webview to 'emulate' internet explorer
and call an url.
My application, a PMS (planning management system) for hotel, which is called by an url,
runs very badly on android 4.4 pad
thanks in advance
michel
 

warwound

Expert
Licensed User
Longtime User
You could try my WebViewSettings library and it's setUserAgentString method.

You'll need to know what user agent string is required to emulate IE - i'd suggest you Google for that info.

Martin.
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
Hi martin
thanks for your reply
the WebViewSettings library is not in my referenced library list
how can I downloaded it?

thanks in advance
michel
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
HI Martin
I downloaded:
WebViewSettings_v_1.30.zip
could you tell me how to incorporate the library in my project
sincerely
michel
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
You need to first Dim an instance of WebViewSettings.

You can do that in Globals:

B4X:
Sub Globals
   Dim WebViewSettings1 As WebViewSettings
End Sub

Now somewhere in Activity_Create or another Sub once your WebView has been initilialized, you can use:

B4X:
Sub Activity_Create(FirstTime As Boolean)
   WebViewSettings1.setUserAgentString(WebView1, "what to use here?")
End Sub


"what to use here?"

You will have to experient with user agent string values: https://www.google.co.uk/search?q=android+webview+user+agent&ie=UTF-8&oe=UTF-8

Martin.
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
hi Martin
thanks for your answer
I got the useragent string for IE:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET4.0C; .NET CLR 3.0.30729; Zune 4.7; .NET4.0E)

What I don't know is what to do after having downloading
WebViewSettings_v_1.30.zip in a folder of my pc:
c:\Android\WebViewSettings_v_1.30
in
c:\Android\additionnal_lib
i loaded the unzipped files
in
c:\Android\additionnal_lib\Additional libraries
there is an executable jar file:
WebViewSettings
If I make Add Files in the the project
it does not work
"Dim WebViewSettings1 As WebViewSettings" is still in red

could you help me
sincerely
michel
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
Hi
thanks for the mail
the WebViewSettings library is not in my referenced library list
when I click on lib in the right side of the IDE.
In this list just
core( version: 1.77)
and HTTP (vesion:1.10)
are checked.
if the executable jarfile WebviewSettings is the right file
how can I transfer it to the library list of the project?

sincerely
michel
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
In the B4A IDE click the Tools menu then Configure Paths.

The path set for 'Additional libraries' is the folder where you need to extract both WebViewSettings.jar and WebViewSettings.xml.

Now you can use the library in your code:

B4X:
Sub Process_Globals
End Sub

Sub Globals
   Dim WebView1 As WebView
   Dim WebViewSettings1 As WebViewSettings
End Sub

Sub Activity_Create(FirstTime As Boolean)
   WebView1.Initialize("WebView1")
   Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
   
   WebViewSettings1.setUserAgentString(WebView1, "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET4.0C; .NET CLR 3.0.30729; Zune 4.7; .NET4.0E)")
   
   WebView1.LoadUrl("http://www.b4x.com/forum/basic4android-updates-questions/20157-webview-internet-explorer-android-4-4-a.html#post116620")
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Martin.
 

Attachments

  • WebViewUserAgent.zip
    5.7 KB · Views: 357
Upvote 0

caillaud

Member
Licensed User
Longtime User
Hi
in fact I fixed the incorporation of the addtional library WebViewSettings in the project
I inserted the files in the library directory:
c:\programs\anywhere software\basic4android\libraries

but with the useragentstring:
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET4.0C; .NET CLR 3.0.30729; Zune 4.7; .NET4.0E)"
nothing is changed
using or not
WebViewSettings1.setUserAgentString(webview1, myuseragent)
any idea?
thanks in advance
michel
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
From what I understand, is your problem a bad format (for example) in your view? I mean, you see objects improperly?
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Maybe i misunderstood your first post...

Are you saying that on an Android ICS device you can request the desktop version of a web page with the native Android browser and it works acceptably, but viewing the same page with a B4A WebView is unacceptable?

If so then visit this page with your Android ICS device browser:
http://android.martinpearman.co.uk/b4a/temp/user_agent.php

It's a simple page:

PHP:
<?php 
 echo $_SERVER['HTTP_USER_AGENT'];
 ?>

You can try using the user agent that that page displays in WebViewSettings.

If however you are trying to view a web page that only properly displays in IE and you want a B4A WebView to render the web page the same as IE then you might be out of luck...

Can you post the URL of the web page that you want to display?

Martin.
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
Hi
thanks for your answer
yes It is a bad format view,using or not WebViewSettings1.setUserAgentString(webview1, myuseragent) when testing on the basic4android simulator
(but may be i have to test on the tablet)
it is the same bad format as I run the application under google chrome on a pc
on a pc it is fine with IE,firefox and safari not with google chrome(!!!)
when calling the application directly on the navigator
(on Ipad it is better than on android, but not totally perfect)

On pc under windows, a small program in vb.net call the application,installed on an external computer,using a WebBrowser control (this control simulate IE).
So the client is obliged to use IE.
I would like to do the same on android pad:
just installing on the tablet a small program which call the application simulating IE when activated
so I would not have anything to modify on the heavy central application running on the external computer.
If it is not possible I have to rewrite a special applicaion for tablet

do you get the problem?
sincerely
michel
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
hi thanks for your answer
the url of the page I want to diplay is:
accueil

click on planning:
vertical:rooms
horizontal:calendar
the checkboxs are 3 times too high
obama is affected to the room number 3

do you think I have to rewrite my application for having obama on the line of room 3
sincerely
michel
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
While it's truly very convenient to have a one-size-fit-all app, I think that you might want to try setting up your app in a more android-specific way. Some of the apps I've developed were originally planned to be 'universal' thus web-based. Very soon I discovered things didn't go as well as originally expected. But surely, I can understand, this involves again many hours of developing, this is a common problem for the majority of developers, I guess.
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
Hi
thanks very much for your answer

unfortunately I am going to follow your advises

very sincerely
michel
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Hi
thanks very much for your answer

unfortunately I am going to follow your advises

very sincerely
michel

Good luck! Who knows, perhaps other members here, can give you a clue about your problem. Anyway, b4a is an excellent tool for rapid development, I am sure you ll recreate your app very fast :)
 
Upvote 0
Top