Bing maps doesn't work in Mozilla Firefox 26 - firefox

On Mozilla Firefox version 26 bing maps doesn't work. I dosn't zoom and locate (and location service are enabled in firefox settings). In don't get any error or warning. In all other browsers (IE, Chrome...) all works fine. Where is problem?

It should work with Firefox 26 according to the supported browser information.
Firefox 3.6 and later
It works fine when I run it on Windows.

function GetLocation() {
if (!!navigator.geolocation) {
navigator.geolocation.getCurrentPosition(UpdateLocation, HandleErrors);
}
}
function UpdateLocation(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
setPushpin(longitude, latitude);
document.getElementById('longitude').value = longitude;
document.getElementById('latitude').value = latitude;
Microsoft.Maps.Events.addHandler(map, 'click', changePosition);
}
function HandleErrors(error) {
switch (error.code) {
case error.PERMISSION_DENIED: alert("user did not share geolocation data");
break;
case error.POSITION_UNAVAILABLE: alert("could not detect current position");
break;
case error.TIMEOUT: alert("retrieving position timed out");
break;
default: alert("unknown error");
break;
}
}
function setPushpin(longi, lati){
map.setView({ center: { latitude: lati, longitude: longi }, zoom: 16});
deletePushpin();
var newURL = window.location.protocol + "//" + window.location.host + "/";
var pushpin= new Microsoft.Maps.Pushpin(map.getCenter(), {icon:newURL+"images/marker.png", height:35, width:26});
map.entities.push(pushpin);
pushpin.setLocation(new Microsoft.Maps.Location(lati, longi));
}
function deletePushpin(){
for(var i=map.entities.getLength()-1;i>=0;i--){
var pushpin= map.entities.get(i);
if (pushpin instanceof Microsoft.Maps.Pushpin){
map.entities.removeAt(i);
}
}
}
changePosition = function (e) {
if (e.targetType == "map") {
var point = new Microsoft.Maps.Point(e.getX(), e.getY());
var loc = e.target.tryPixelToLocation(point);
document.getElementById('longitude').value = loc.longitude;
document.getElementById('latitude').value = loc.latitude;
setPushpin(loc.longitude, loc.latitude);
}
}
So this is my code for getting current locations and put pushpin on it.
I don't get any error. Map isn't doing anything just stays on full world view.
On all other browsers works just fine, it zooms, get current location and put pushpin on it.
This is where I call map:
map = new Microsoft.Maps.Map(document.getElementById('placeForMap'), {credentials:"xxx",showMapTypeSelector:false, disableBirdseye: true});
GetLocation();
I tried to use Bing Ajax 7 controls, but same problem is there too, bing map in firefox is drop dead, and in other browser works fine.

There is no issue with the Bing Maps control. Firefox 26 has a couple of bugs in it which are causing the issue you are encountering.

Related

Override Keyboard Shortcuts in Firefox

How do I override Keyboard Shortcuts in Firefox so that it can be picked up by web page
For example, I have a webpage that detects ctrl-shift-h which worked fine in version 56 but now in version 96 it brings up a "Show All History" dialog
I am doing many such things so I looking for a generic way to override Firefox keyboard shortcuts
I found a way by adding two files under the Firefox directory
Firefox64\defaults\pref\config-prefs.js
pref("general.config.filename", "config.js");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);
Firefox64\config.js
let { classes: Cc, interfaces: Ci, manager: Cm } = Components;
const {Services} = Components.utils.import('resource://gre/modules/Services.jsm');
function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
ConfigJS.prototype = {
observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
handleEvent: function (aEvent) {
let document = aEvent.originalTarget; let window = document.defaultView; let location = window.location;
if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
if (window._gBrowser) {
let keys = ["key_find", "key_findAgain", "key_findPrevious", "key_gotoHistory", "addBookmarkAsKb", "bookmarkAllTabsKb", "showAllHistoryKb", "manBookmarkKb", "viewBookmarksToolbarKb", "key_savePage", "key_search", "key_search2", "focusURLBar", "focusURLBar2", "key_openDownloads", "openFileKb", "key_reload_skip_cache", "key_viewSource", "key_viewInfo", "key_privatebrowsing", "key_quitApplication", "context-bookmarklink"];
for (var i=0; i < keys.length; i++) {
let keyCommand = window.document.getElementById(keys[i]);
if (keyCommand != undefined) {
keyCommand.removeAttribute("command");
keyCommand.removeAttribute("key");
keyCommand.removeAttribute("modifiers");
keyCommand.removeAttribute("oncommand");
keyCommand.removeAttribute("data-l10n-id");
}
}
}
}
}
};
if (!Services.appinfo.inSafeMode) { new ConfigJS(); }
You can get a list of ids for the keys from the source by putting the following URL in your browser
view-source:chrome://browser/content/browser.xhtml
Sorry I can't comment yet but to extend zackhalil answer:
For those on Linux or simillar Unix/Unix-like systems replace Firefox64 for /usr/lib/firefox. Don't be confused with $HOME/.mozilla/firefox

Map pans and zooms when opening info window

when I click on a marker the map always re-pans and zooms to the initial state. Not such a big deal for a single marker but if I start with a cluster, zoom in and then click on a marker there is the problem. It zooms out, reclusters and then pops up the window. Anybody come across this issue?
This is what it looks like:
Here is the relevant code:
var loc = { latitude: item.Latitude, longitude: item.Longitude };
var marker = { location: loc, label: item.Label, id: item.Id, value: item.Value,showWindow:false };
markers.push(marker);
marker.onClick = function () {
if ($scope.$$phase || $scope.$root.$$phase) {
this.model.showWindow = true;
} else {
var self = this;
$scope.$apply(function() {
self.model.showWindow = true;
});
}
};
And the markup. This is in another directive that allows me to just keep a list of different layer types:
'<markers models="mylayer.locations" coords="\'location\'" doRebuildAll="true" idKey="\'id\'" doCluster="true" fit="true" options="mylayer.options" click="\'onClick\'">' +
'<windows show="\'showWindow\'" doRebuildAll="false" disableAutoPan="true" data-ng-if="mylayer.options.clickable" ng-cloak>' +
'<div>hello</div>' +
'</windows>' +
'</markers>'
Turns out the problem happened when updating from version 1.1.0 of angular-google-maps.js to version 1.1.4. Reverted and it works fine now.

google map v3, cannot load marks for firefox 26.0(latest version)

For now we are using google map v3, after we upgraded firefox 26.0, the marks cannot be loaded
I set many alerts and compared them between Chrome and firefox 26.0, I found here is a variable this.ready_ cannot be assigned a value(true) in firefox 26.0 , that is this method cannot be called below
MarkerClusterer.prototype.onAdd = function() {
alert("enter MarkerClusterer.prototype.onAdd!");
this.setReady_(true);
};
MarkerClusterer.prototype.setReady_ = function(ready) {
alert("enter setReady!");
if (!this.ready_) {
this.ready_ = ready;
alert("will enter createClusters_() in setReady_");
this.createClusters_();
}
};
I tried to find where does call onAdd for pinpoint the issue, however, it called by google itself, here is stack call
MarkerClusterer.onAdd MarkerClusterer.js:225
mG VM148:1
anonymous function %7Bmain,places%7D.js:11
Thank you by advance!
Jason
I have fixed this issue, the problem was from MarkerClusterer.js, someone commentted these 2 lines below leads to this issue(just comment them off will be ok), hope it is also helpful for others.
in MarkerClusterer.js
MarkerClusterer.prototype.setupStyles_ = function() {
if (this.styles_.length) {
return;
}
// for (var i = 0, size; size = this.sizes[i]; i++) {
this.styles_.push({
url: this.imagePath_ + '.' + this.imageExtension_,
height: 36,
width: 43
// });
}

dragover event is no not firing in firefox

I'm working to simulate files and directories structure ,using drag and drop,
my code is working fine in IE, Chrome but not working in Firefox ,
while i'm searching i found this fiddle .
> http://jsfiddle.net/G9mJw/20/
same problem works on IE,Chrome but not Firefox !
http://jsfiddle.net/G9mJw/140/
var dropzone = document.getElementById('dropzone');
var draggable = document.getElementById('draggable');
draggable.addEventListener('dragstart', onDragStart, false);
dropzone.ondragover = function(e){e.preventDefault(); }
dropzone.ondrop = function(e){ onDragOver(e); }
function onDragStart(event) {
event.dataTransfer.setData('text/html', null); //cannot be empty string
}
function onDragOver(event) {
var counter = document.getElementById('counter');
counter.innerHTML = parseInt(counter.innerHTML) + 1;
}

How to detect if pdf.js is *default* reader in firefox

Since Firefox 19, there is an internal default PDF reader "pdf.js". How can I detect whether this is the reader by default?
This might be what you are looking for...
http://www.pinlady.net/PluginDetect/PDFjs/
This will test for it. I can't get to the other link due to corporate firewall. Dunno what it says. Maybe its the same.
FIDDLE HERE
<iframe src="some.pdf" id="iframe" name="iframe"></iframe>
.
// FireFox test for PDFJS to display PDFs. Works in 20 & 21.
// If you don't test for the browser ...
// IE says PDFJS is there. It isn't.
// Chrome hangs on the fiddle
// Safari for Windows says PDFJS isn't there
$(window).load(function() {
var userAgent = navigator ? navigator.userAgent.toLowerCase() : "other";
if(userAgent.indexOf("firefox") > -1) {
var $iframe = $("#iframe");
var $innerDiv;
try {
$innerDiv = $iframe.contents().find('div');
alert("PDFJS not loaded");
} catch (e) {
alert("PDFJS loaded");
}
} else {
alert("Not running in FireFox - no PDFJS available");
}
});

Resources