[OpenLayers-Users] Firefox help needed for google sphericalMercator
<OpenLayers.Bounds is not a constructor>
Linda Rawson
linda.rawson at gmail.com
Wed Jan 9 18:59:40 EST 2008
Ok. I need the ability to load the googlekey outside the default page.
So in sphericalMercator.html it is loaded this way:
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
I created this file called google.js which is the following:
////////////////////
var GOOGLE_TILES_KEY="ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ";
var GOOGLE_TILES_SERVER="http://maps.google.com/maps?file=api&v=2&key=";
var ____path = "";
function urlPath(path, notCtx) {
var incCtx = notCtx || false;
var url = (!incCtx ? ____path : "") + path;
return url;
}
function loadScript(path, notCtx) {
var url = urlPath(path, notCtx);
document.write ('<' + 'script src="' + url + '"'+'
type="text/javascript"><' + '/script>');
}
function init() {
var sloc = "";
var SCRIPT_NAME = "googleKey.js";
var scripts = document.getElementsByTagName('script');
for (var i = 0; i < scripts.length; i++) {
var src = scripts[i].getAttribute('src');
if (src) {
var index = src.lastIndexOf(SCRIPT_NAME);
// is it found, at the end of the URL?
if ((index > -1) && (index + SCRIPT_NAME.length == src.length)) {
sloc = src.slice(0, -SCRIPT_NAME.length);
break;
}
}
}
____path = sloc;
loadScript(GOOGLE_TILES_SERVER + GOOGLE_TILES_KEY, true);
}
init();
////////////////////
This works fine in internet explorer but in firefox I get:
OpenLayers.Bounds is not a constructor
Any ideas?
--
Linda Rawson
More information about the Users
mailing list