×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    23

    Problem with Google Map in WebView

    Hi all,

    I try to use Google Maps Javascript API in the HTML file and show it on QML WebView to show the map with specific coordinate. But it just displayed the constants size, I can't interact with it (e.g. Click, Zoom...), like below.



    This javascript code works fine on Symbian^3, but not with Symbian^1. I'm using N97 mini. Is there something wrong with it?

    Sorry for my bad English.

    The html file is like below:
    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title> Sample Widget</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script language="javascript" type="text/javascript" src="basic.js"></script>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript"> 
    	var map;	
        var latlng = new google.maps.LatLng(54, -4.57);
    	var directionDisplay = new google.maps.DirectionRenderer();
      function initialize() {
        var myOptions = { 
          zoom: 5, 
          center: latlng, 
          mapTypeId: google.maps.MapTypeId.ROADMAP,	  
    		panControl: false,
    		zoomControl: false,
    		scaleControl: false,
    		mapTypeControl: false,
    		streetViewControl: false
        }; 
        map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    	directionDisplay.setMap(map);
      }
    </script>
     
    <body onLoad="initialize()" BGCOLOR="#FFFFFF">
    <div id="map_canvas" style="width:100%; height:100%"></div>
    </body>
    </html>
    Last edited by stevensei; 2011-06-20 at 10:34.

  2. #2
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Problem with Google Map in WebView

    Hi,
    I don't know Google Map API, but I've seen you set the following options to the map object:

    panControl: false,
    zoomControl: false,
    scaleControl: false,
    mapTypeControl: false,
    streetViewControl: false

    Are those options the cause of your problems?

  3. #3
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Problem with Google Map in WebView

    Hi,
    I don't know Google Map API, but I've seen you set the following options to the map object:

    panControl: false,
    zoomControl: false,
    scaleControl: false,
    mapTypeControl: false,
    streetViewControl: false

    Are those options the cause of your problems?

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    23

    Re: Problem with Google Map in WebView

    Hi gnuton,

    I think it's not a cause. Because when I set all of them to true, the problem is still exists.

  5. #5
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Problem with Google Map in WebView

    Hi,
    I saved your code in an html page and I loaded it in Chromium/Chrome and it doesn't work. I'm not able to pan or zoom.
    Same code works nicely on Firefox4. So I suspect there is something wrong with webkit (Chrome is webkit based).

    I guess you have to fix something in your html file to make it Webkit compatible.

  6. #6
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Problem with Google Map in WebView

    I've to correct myself. The html page works fine with webkit. It didn't work for me because I changed the browser user agent.
    I'm wondering if that could be the cause of your problem too...
    Could it be that Google's JS scripts don't recognize the user agent string? It could be different between Qt for S¹ and S³
    Last edited by gnuton; 2011-06-23 at 06:32.

  7. #7
    Registered User
    Join Date
    May 2009
    Posts
    23

    Re: Problem with Google Map in WebView

    Hi gnuton,

    I don't undestand your meaning. You said that it works fine with webkit. And what user agent you are using? Chrome or Firefox or anything else?

    Sorry for my bad English.

    Thanks

  8. #8
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Problem with Google Map in WebView

    Hi,
    So... the problem that you are facing could be related to google maps javascript. I've seen from my tests that it's really important tha google maps recognize your browser.
    If you are sure that webview has javascript enabled they you should take a look at which "user agent" it's using. Maybe it returns an empty string.. You can use http://whatsmyuseragent.com/ to check your useragent.

Similar Threads

  1. Problem with Google Map API
    By smartsumit in forum Mobile Java General
    Replies: 5
    Last Post: 2009-04-02, 15:31
  2. Replies: 2
    Last Post: 2009-02-13, 04:19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×