cant load html googlemaps in webbrowser

General questions about NeoBook

Moderator: Neosoft Support

Locked
yanzco
Posts: 192
Joined: Sun Jul 20, 2014 4:07 am

cant load html googlemaps in webbrowser

Post by yanzco »

i have this html file.. that when loaded to webbrowser in neobook, i can get variables, LAT and LNG as an green pin is moved around the map..

it was working, a few months or a year ago.. but now, recently found out it wont work... just a white screen..

it seems to be loading fine in IE11 or firefox.. but wen loaded inside neobook, that's where the problem starts..

Code: Select all

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBL1leGu9wHdlfZMmR5NCHZfFtVC8dYBpw "></script>
<script type="text/javascript">
    var GetLocMarker = [
        {
            "title": 'VendorLocation',
            "lat": '8.48466024214509',
            "lng": '124.652717216301',
            "description": '',
			"iconicon": 'http://maps.google.com/intl/en_us/mapfiles/ms/micons/green.png'
		}
    ];
	
	var HQmarkers = [
        {
            "title": 'VEPCO HQ',
            "lat": '8.484371081025191',
            "lng": '124.65269575862885',
            "description": 'VEPCO HQ',
			"iconicon": 'https://vepcocommand.000webhostapp.com/VCicons/VEPCOHQ.png'
        }
		,
		{
            "title": 'DAVE',
            "lat": '8.48451168233085',
            "lng": '124.652900947618',
            "description": 'DAVE',
			"iconicon": 'https://vepcocommand.000webhostapp.com/VCicons/Icon_Depot 1.png'
        }
		
    ];
	
	
	
	
	
	
    window.onload = function () {
        var mapOptions = {
            zoom: 10,
			center: new google.maps.LatLng(HQmarkers[0].lat, HQmarkers[0].lng),
            mapTypeId: google.maps.MapTypeId.HYBRID
        };
        var infoWindow = new google.maps.InfoWindow();
        var latlngbounds = new google.maps.LatLngBounds();
        var geocoder = geocoder = new google.maps.Geocoder();
        var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
		
		//var iconHQ = 'https://vepcocommand.000webhostapp.com/VCicons/VEPCOHQ.png';
		//var icongreen = 'http://maps.google.com/intl/en_us/mapfiles/ms/micons/green.png';
		
		
		//GetLocMarker
		for (var i = 0; i < GetLocMarker.length; i++) { //loops array of markers
            var data = GetLocMarker[i]
            var myLatlng = new google.maps.LatLng(data.lat, data.lng);
            var marker = new google.maps.Marker({
                position: myLatlng,
                map: map,
                title: data.title,
                draggable: true,
				icon: data.iconicon,
                animation: google.maps.Animation.DROP
            });
            (function (marker, data) {
                //google.maps.event.addListener(marker, "click", function (e) {
                    //infoWindow.setContent(data.description);
                    //infoWindow.open(map, marker);
                //});
                google.maps.event.addListener(marker, "dragend", function (e) {
                    var lat, lng, address;
                    geocoder.geocode({ 'latLng': marker.getPosition() }, function (results, status) {
                        if (status == google.maps.GeocoderStatus.OK) {
                            lat = marker.getPosition().lat();
                            lng = marker.getPosition().lng();
                            address = results[0].formatted_address;
                            //alert("Latitude: " + lat + "\nLongitude: " + lng + "\nAddress: " + address);
							window.external.nbSetVar( '[mapsLAT]', lat );
							window.external.nbSetVar( '[mapsLONG]', lng );
                        }
                    });
                });
            })(marker, data);
            latlngbounds.extend(marker.position);
        }
		
		//HQ markers
		for (var i = 0; i < HQmarkers.length; i++) { //loops array of HQmarkers
            var data = HQmarkers[i]
            var myLatlng = new google.maps.LatLng(data.lat, data.lng);
            var marker = new google.maps.Marker({
                position: myLatlng,
                map: map,
                title: data.title,
                draggable: false,
				icon: data.iconicon,  //(this sets all icons of variable markers to iconHQ)
                animation: google.maps.Animation.DROP
            });
			
			// this function sets the markers to display infowindow when clicked
            //(function (marker, data) {
            //    google.maps.event.addListener(marker, "click", function () {
            //        infoWindow.setContent(data.description);
            //        infoWindow.open(map,marker);
            //    });
            //})
			
			//this function sets all markers to display their infowindow automatically
			var infowindow = new google.maps.InfoWindow({
				content: (HQmarkers[i].description),
				//content: data.description[i][0],
				//maxWidth: 200
				//infoWindow.setContent(data.description)
			});
			infowindow.open(map, marker, data);
			
			(marker, data);
            latlngbounds.extend(marker.position);
        }
		

        var bounds = new google.maps.LatLngBounds();
        map.setCenter(latlngbounds.getCenter());
        map.fitBounds(latlngbounds);
    }
</script>
<div id="dvMap" style="width: 750px; height: 630">
</div>
User avatar
luishp
Posts: 410
Joined: Wed May 23, 2007 10:17 am
Location: Spain
Contact:

Re: cant load html googlemaps in webbrowser

Post by luishp »

It works fine for me. At least in Windows 7 with IE11.
I have saved your code to a HTML file and loaded it into a WebBrowser object.
Map and signs are displayed correctly.
I will try later at home with Windows 10.
Regards.
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
yanzco
Posts: 192
Joined: Sun Jul 20, 2014 4:07 am

Re: cant load html googlemaps in webbrowser

Post by yanzco »

im using win10

when the marker is moved and placed, it stores the lat and long to neobook variables..

but somehow, mine just displays a white webbrowser when trying to load the html..

thou when i use firefox or ie11 outside, it seems fine..
only inside webbrowser of neobook shows whitepage.. :o

edit: tried it on another desktop.. it seems to work properly now... was weird.. seems not to work on my laptop where i work..
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: cant load html googlemaps in webbrowser

Post by Gaev »

yanzco:

This may be due to recent initiatives by Google to "Make the Internet Safer".

On their Chrome browsers, the latest version is going to warn users that access any page via non-https protocol that the web page may be harmful.

They may also have decided not to service any requests to their properties (like Maps) from older (unsafe in their opinion) versions of Browsers.

When you deploy the WebBrowser object in NeoBook, the rendering may be done by an older version of the Browser (not IE11 or Microsoft Edge).

I have not had time to try this myself, but this code inside your html ...

Code: Select all

userAgentString = navigator.userAgent;
alert(userAgentString);
... might give you an indication of the rendering engine used with the WebBrowser object in NeoBook.

It is not clear from your post where the html/javascript is stored (local file ?) ... if possible, you might try and load the html/javascript file to a secure server ... and then call this file (and all other files referenced within the html) via https from your NeoBook application ... if that works, it could be the protocol thing ... otherwise, it would be the rendering engine (browser/version) thing.
yanzco
Posts: 192
Joined: Sun Jul 20, 2014 4:07 am

Re: cant load html googlemaps in webbrowser

Post by yanzco »

from the old desktop working web (ran from neobook web open html)
it says Mozilla/5.0 (Windows NT 6.2;WOW64; Trident/7.0;rv:11.0) like Gecko


then at my laptop.. ran from neobook web open html
sows white page.. nothing..


then ran from ie explorer open file html
Mozilla 5.0 (Windows NT 6.2;WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.050727; .NET CLR 3.0.30729; .NET C:R 3.5.30729 ; rv:11.0) like Gecko


i only used pre-made html file.. and load it locally from PubDir..
since i dont know much html..
i dont know how to load the html/javascript file to a secure server and call the file
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: cant load html googlemaps in webbrowser

Post by Gaev »

yanzco:
then at my laptop.. ran from neobook web open html
sows white page.. nothing..
Just use another html file ... with just the afore mentioned code ... and some simple text (like "Hello World") ... no html/script associated with the Google Maps display ... that will tell you what "user agent" is being utilized in your laptop.
yanzco
Posts: 192
Joined: Sun Jul 20, 2014 4:07 am

Re: cant load html googlemaps in webbrowser

Post by yanzco »

alright..

it says

Mozilla /4.0 (compatible; MSIE 7.0; WIndows NT 6.2; WOW64; Trident/7.0; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: cant load html googlemaps in webbrowser

Post by Gaev »

yanzco:
from the old desktop working web (ran from neobook web open html)
Mozilla/5.0 (Windows NT 6.2;WOW64; Trident/7.0;rv:11.0) like Gecko

then ran from ie explorer open file html
Mozilla 5.0 (Windows NT 6.2;WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.050727; .NET CLR 3.0.30729; .NET C:R 3.5.30729 ; rv:11.0) like Gecko

laptop
Mozilla /4.0 (compatible; MSIE 7.0; WIndows NT 6.2; WOW64; Trident/7.0; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)
Looks like it works when Browser Agent is Mozilla/5.0 but not when it is Mozilla /4.0
thou when i use firefox or ie11 outside, it seems fine..
only inside webbrowser of neobook shows whitepage..
What is the Browser Agent when you use ie11 outside ?
yanzco
Posts: 192
Joined: Sun Jul 20, 2014 4:07 am

Re: cant load html googlemaps in webbrowser

Post by yanzco »

browser agent at ie11 is
Mozilla 5.0 (Windows NT 6.2;WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.050727; .NET CLR 3.0.30729; .NET C:R 3.5.30729 ; rv:11.0) like Gecko
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: cant load html googlemaps in webbrowser

Post by Gaev »

yanzco:
browser agent at ie11 is
Mozilla 5.0 (Windows NT 6.2;WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.050727; .NET CLR 3.0.30729; .NET C:R 3.5.30729 ; rv:11.0) like Gecko
So, it is confirmed ... Google Maps API does NOT support Browser Agent Mozilla 4.0

I did a Google Search using "Google Maps api" AND "Mozilla 4.0" and found others experiencing similar issues ...

https://www.google.ca/search?q=%22Googl ... e&ie=UTF-8

... there seems to be a way to change the (default) User Agent ... but it requires changes to the Windows Registry ...

https://stackoverflow.com/questions/258 ... 8#25843958
yanzco
Posts: 192
Joined: Sun Jul 20, 2014 4:07 am

Re: cant load html googlemaps in webbrowser

Post by yanzco »

tried to follow the registry guide and
tried to add new DWORD32bit value with ''nameofexe'' with 9999 value and 9000

both did not work..

:shock:
Locked