Google maps v3.19 won't load using embedded VB6 browser - javascript

We have a legacy VB6 application which until 17/2/2014 was loading and displaying maps using the Google maps V3 API perfectly. This was achieved by creating an html file and loading it using the VB6 browser ocx control. Now the maps won't load and the following error appears.
"Error: Could not get the display property. Invalid argument."
Opening the generated htm file using Explorer or Chrome works without any problems.

Ran into the same problem today with a c# app which has the windows forms webbrowser control
Got the maps working by changing the api call from
"https://maps.googleapis.com/maps/api/js?v=3.exp"
to
"https://maps.googleapis.com/maps/api/js?v=3.19">

Change your reference to the API to be:
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
and it will fix it because this is a default reference to the release version (which is 3.19) that works.
3.20 - The experimental does not work.

after more research: According to this link : https://code.google.com/p/gmaps-api-issues/wiki/JavascriptMapsAPIv3Changelog, all calls to 3.17 will serve 3.18. excerpt below:
3.20 17 February 2015
The current JavaScript Maps API v3 experimental version (3.19) will become the release version.
Version 3.17 will be removed. Requests for 3.17 or any prior version will now be served version 3.18.
Versioning documentation is available at: https://developers.google.com/maps/documentation/javascript/basics#Versioning
Available versions after rollover:
Experimental: 3.20
Release: 3.19
Frozen: 3.18

Adding
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" >
directly under the head tag in the web page the browser is displaying worked for me if you still have access to that.

We had this same an issue with powerbuilder with embedded browser ..
Here's how to fix .. use regedit goto key as visible on bottom of image, you will see key. create a reg_dword and name it to you application (ours is tpdesp.exe) The data of 8000 says to use IE8 (which almost all of our customers have). You can set this to 9000 or 10000, use google to get explanations of this.
notes : The app we had the issues with is a 32 bit app running on windows7 64. If that's not what you have search the registry for feature_browser_emulation and fix it there.
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]

It's working (Windows Forms C# in WebControl)
Only adding: v=3.19
public static string llamadaMapas = "<script type=\"text/javascript\" src=\"https://maps.google.com/maps/api/js?**v=3.19**&sensor=false\"></script>";

This fixed a similar problem with GeoSetter. (Map not working.) I had to search in the registry for the feature_browser_emulation key area to be added to, but Geosetter now works. (Just added the key and restarted the program.)
Thank you.

Related

Issue migrating from GA to GTAG on ionic/cordova web app

Description
Since old GA SDK is getting obsolete, we are migrating to GTAG.
While migrating, I found this line :
ga('set', 'checkProtocolTask', null);
which disables the protocol check so that GA script works in a webview (where cordova uses the file:// protocol apparently)
What I've tried
I looked through the internet (about 2-3 pages of "similar but not quite the same" problems)
Only solution I found is there : https://support.google.com/analytics/answer/7475953?hl=uk
TLDR : add a script in Google Tag Manager, which will disable the protocol check for all trackers in google analytics and use that script in Google Analytics setup.
But :
* we are not using Google Tag Manager as of now, so we'd have to set the thing up just for that.
* it seems like a dirty hack to me... But it's not better than the old version I guess...
* I don't think it's good to have this piece of code in Tag Manager, when everything else is in GIT repo.
* It means we are disabling the protocol check, wherever it is called. Whereas the "hack" we had only disabled the protocol check when building the mobile app (desktop web was working without this line)
Is there no other solutions ? am I wrong ?
So... I just realised that using global site tag just uses ga as we used to.
So I actually ended up using the solution from the page I found : https://support.google.com/analytics/answer/7475953?hl=uk
Only I used that code snippet in my page instead of in a GTM variable.
So whenever I load my page, I do
ga(function() {
var trackers = $window.ga.getAll();
trackers.forEach(function(tracker) {
tracker.set('checkProtocolTask', null);
});
});
I wrapped the snippet in a function() {...}, that way it is apparently run after ga is initialized.
For Google Analytics 4 this feature is not yet implemented. So you cant disable protocol check. see the status here https://issuetracker.google.com/issues/174954288?pli=1

Enabling Geolocation for localhost in chrome

I am pretty new to Javascript/html5. I am basically working off code provided in Rbon Nixon's book (4th Edition, Learning PHP, MySQL and Javascript...). Example 22-2 of which is about "displaying the map at a user's location".
I am getting caught in the if part of the following code snippet:
<script>
if (typeof navigator.Geolocation=='undefined')
alert("Geolocation not supported.")
</script>
Superficially, it seems quite obvious that I should enable geolocation int eh browser for localhost. I am using chrome (Version 60.0.3112.113). But when I go to Settings >> Advanced >> Content Settings >> Location
the ask before accessing option is enabled. and then there are the Block and Allow sections. But it does not give me an option to add localhost. How do I enable it so that I can use geolocation in my code and test it on my machine?

Google maps javascript api crashes in phonegap [Hard topic]

I'm facing problems when the client internet connection is unstable. If disconnections occur during the loading process google maps services won't work even when the connection comes back.
The difficulty with phonegap compared to a normal browser is that there is no "reload page" button the user can hit if the page didn't load properly. We thus have to ensure a 100% safe load.
If you follow the instructions provided by Google to implement google maps javascript api in your phonegap app, the loading process will crash at three different steps if the client connection is unstable.
Each crash is independent and a bit complex to explain, so i created sub questions : first crash, second crash, third crash
I also created that file so that anyone can reproduce the crashes.
I suspect that the problem partly comes from google's script, but there is probably a work around i didn't see.
Not sure at all that this could help but I faced an issue regarding multiDex when I tryed to use google map api when adding this code in file build-extras.gradle my google map crash was solved :
android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "2g"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
}
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
What I understood was that using simple Dex I can only implement 65000 method but the google api add lot of them.
Building Apps with Over 65K Methods
Not sure this could help or not, let me know if I should delete this answer.

Grey ribbon on Account form in IE "SCRIPT5: Access is denied." in PageLoader.js

MS CRM 2011 on premise.
No problems if accessed via internal address: crm:5555
Go to crm.ourcompany.co.uk:5555 in IE and load account page and the ribbon is totally grey. (Not disabled - every pixel is the colour grey.)
In Chrome and Firefox the ribbon is loaded fine.
Browser console in IE, Chrome and FF all say access errors.
I can see they are trying to access crm:5555.
IE says:
SCRIPT5: Access is denied.
PageLoader.js, line 1 character 1226
The second line above is presented as a link. Clicking it shows me this: http://pastebin.com/bBadk9HS
The full path is http://crm.ourcompany.co.uk:5555/_static/_common/scripts/PageLoader.js?ver=-1056260279
P.S. IE is "Browser Mode: IE10 Document Mode: IE9 standards".
After Long investigation I have found out the reason for same issue like this.
We had previous rollup activity feed solution.
After importing the new version of Activity feeds this hectic issue was sorted out.
Activity feed new solution is available with rollup up package.it can be found by exacting the rollup package. Previously this was available in Microsoft Dynamic market place.
It turns out that the problem is an address lookup plugin on the Account form.
This is trying to access http://crm:1999, which is a 404, and http://crm:5555, which isn't allowed.
Solutions are to fix the server on http://crm:1999 and set up proper managed internal and external URLs so it'll know whether http://crm:5555 or http://crm.ourcompany.co.uk:5555 or remove the plugin.

Phonegap - Open Navigation Directions in Apple Maps App

I have two variables - Destination and Source - and, using Phonegap, I'm trying to use jQuery to open the external iPhone Apple Maps app with directions.
The code I'm using looks like this:
var url = 'http://maps.apple.com/?q=daddr='+destination+'&saddr='+source;
window.location = url;
Whenever I click the relevant button however, it opens a new view in-app with Google directions as a webview, and I cannot return to the original app.
How can link be opened instead with the iOS default map application?
Changing http://maps.apple.com/?q= to just maps: did the trick.
NB: make sure you write maps: and not map: as, while the latter will run the correct app, it will crash immediately after opening (thanks jprofitt)
Today I was able to open the native Apple Maps app with marker from a Cordova app using BOTH of the follow URL schemes:
maps://maps.apple.com/?q={latitude},{longitude}
AND
maps://?q={latitude},{longitude}
In a link:
<a href="maps://maps.apple.com?q={latitude},{longitude}">
<!-- OR -->
<a href="maps://?q={latitude},{longitude}">
From JavaScript:
window.location.href = "maps://maps.apple.com/?q="+lat+","+lng;
// OR
window.location.href = "maps://?q="+lat+","+lng;
The app is running on an iOS device, iOS version 8.1.2, and cordova-ios is version 3.7.0.
In my case, changing from http://maps.apple.com/?q= to only maps:?q= not solving the problem.
The working scheme that open native Apple Maps with marker is as follows:
maps://maps.apple.com/?q={latitude},{longitude}
full working code:
window.location.href = "maps://maps.apple.com/?q="+lat+","+lng;
Tested working with iOS7.1 simulator, might not works in later version. I don't have the opportunity to test. Sorry.
Supported Apple Maps parameters can be found here:
https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
Credit goes to this SO link: Here
The code
I managed to get this working in 2018 on iOS 11.2 using the following format in iOS:
<a onclick="window.open('maps://?q=51.178847,-1.826160', '_system');">Open in Maps</a>
And this format on Android:
<a onclick="window.open('geo:0,0?q=51.178847,-1.826160', '_system');">Open in Maps</a>
Config permissions
Additionally, don't forget to add permissions to your config.xml file like so:
<allow-intent href="maps:*" />
In my project the geo: intention had existed from the beginning so it took my a while to figure out why this was working on Android and not iOS.

Categories