Trying to load the page using Webview. I create html code:

<html> <head> <title>Моя карта</title> <script type="text/javascript" src=""></script> <script type="text/javascript"> // Создаем обработчик загрузки страницы: DG.autoload(function () { // Создаем объект карты, связанный с контейнером: var myMap = new DG.Map('myMapId'); // Устанавливаем центр карты, и коэффициент масштабирования: myMap.setCenter(new DG.GeoPoint(82.927810142519, 55.028936234826), 15); // Добавляем элемент управления коэффициентом масштабирования: myMap.controls.add(new DG.Controls.Zoom()); }); </script> </head> <body> <div id="myMapId" style="width:500px; height:400px"></div> </body> </html> 

On versions 2.1-2.3.3 of Android, it works perfectly, but on version 4.0.3, it is not possible to load the page. Remains empty webview. How can this be fixed?

  • Strange problem. On the latest version, it should be even cooler than the rest. I advise you to check the installation of libraries and settings. - Anton Mukhin
  • Tried to add to the manifest permishchen access to the network? - Barmaley
  • In the manifesto everything is spelled out. I run the same project on devices with versions 2.1 and 2.3.3 and it works. The same project does not work on 4.0.3 - Maria_1
  • @ Maria_1, To format the code, select it with the mouse and click on the button 101010 of the editor. - Nicolas Chabanovsky
  • Checked in emulator 4.0.3. Through the browser the page is loaded, the map is displayed. Via phonegap I load loadurl, everything is fine too. on a real tablet, too, everything works (in both versions). the error is somewhere near, but not here. - Yura Ivanov

2 answers 2

In general, this is not a bug, but a feature, or rather a fixed bug. DoubleGis uses cookies that are not set for about: blank, for it is not security.

In short, you need to replace in your example

 WebView1_H.loadDataWithBaseURL(null, html, mime, encoding, null); //Здесь первый параметр null эквивалентен базовому url about:blank 

on something like (literally):

 WebView1_H.loadDataWithBaseURL("", html, mime, encoding, null); 

Tested in the emulator and on a real device.

  • The same goes for localStorage. See StackOverflow: Android 4.0.1 breaks WebView HTML 5 local storage? and android: Issue 16175 . By the way, why do you load html through a string and not from assets? it's easier and easier to debug ... - Yura Ivanov
  • I just started to deal with all this and so far I tried to do everything in a simple way, so I did not go into asset's. Thank you so much for the answer) I suffered a lot with this) - Maria_1

If everything is as you described it, then it draws you to a minor bug report. You can set a bug here . It seems that ICS does not want for some reason to load the script from an external source (although it seems to be available). If the bug is confirmed, then very soon you will receive a response from the Android developers.

PS It is necessary to double-check all the same on other devices. It would be nice if people got rid of the full source code.

  • I checked on the emulator and on the phone with android 4.0.3. Nothing happened. Just a beige screen. Here are the sources of - Maria_1
  • @ Maria_1 in the evening, if I don’t forget, I’ll look at both the emulator and ICS device - Barmaley
  • I will wait :) - Maria_1