Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18840
| From | "Tony" <tony.johansson@inport.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: problem with google map when using IE 10 |
| Date | 2013-03-11 13:25 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <khkidi$utl$1@dont-email.me> (permalink) |
| References | (1 earlier) <xZKdnVv8dttDC6DMnZ2dnUVZ_rCdnZ2d@westnet.com.au> <khk6la$6va$1@dont-email.me> <kICdnVv6kYTtPqDMnZ2dnUVZ_uWdnZ2d@westnet.com.au> <khk9dp$jnh$1@dont-email.me> <khkfip$go3$1@dont-email.me> |
It works now in IE 10
//Tony
"Tony" wrote in message news:khkfip$go3$1@dont-email.me...
I have now change a bit and now I have come a bit longer
The code looks like this and the alert is saying google map is loaded so I
now the the loader has loaded the google.map.
Now I get an error on this line
map = new google.maps.Map2(document.getElementById("map"));
and the error is in swedish
Körningsfel i JavaScript: Objektet kan inte hantera denna åtgärd.
and translated to english it is
runtime error in JavaScript: Object can not handle this action
Is it anyone that have any idea how to fix it ?
Note the exact same code work fine in Firefox.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>Google Maps and jQuery</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<link href="../JavaScript/jquery/themes/base/jquery-ui.css"
type="text/css" rel="stylesheet" media="all" />
<script src="../JavaScript/jquery/jquery.js" type="text/javascript" />
<script src="../JavaScript/jquery/jquery.cookie.js"
type="text/javascript" />
<script src="../JavaScript/jquery/ui/jquery-ui.js"
type="text/javascript"></script>
<script type="text/javascript">
google.load("maps", "2", { "other_params": "sensor=false" });
if (google && google.maps)
{
alert("google map is loaded");
}
function init()
{
map = new google.maps.Map2(document.getElementById("map"));
var myLatLng = new google.maps.LatLng(58.135148, 12.122726,
true);
map.setCenter(myLatLng, 15);
var myMarker = new google.maps.Marker(myLatLng, { "title":
"Eken" });
map.addControl(new google.maps.LargeMapControl());
map.addControl(new google.maps.MapTypeControl());
map.setMapType(G_SATELLITE_MAP);
map.addOverlay(myMarker);
};
google.setOnLoadCallback(init);
</script>
</head>
<body>
<div id="map" style="width: 400px; height: 400px; margin: auto;
background-color: red">
This is where the map will soon appear.
</div>
</body>
</html>
"Tony" wrote in message news:khk9dp$jnh$1@dont-email.me...
I changed the code but I stilll get google not defined on this line
google.load("maps", "2", { "other_params": "sensor=false" });
I have google but no suggestion has helped so far.
Have you some more idea what I can do ?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
window.onload = function ()
{
google.load("maps", "2", { "other_params": "sensor=false" });
init();
// google.setOnLoadCallback(init);
};
function init()
{
map = new google.maps.Map2(document.getElementById("map"));
var myLatLng = new google.maps.LatLng(58.135148, 12.122726,
true);
map.setCenter(myLatLng, 15);
var myMarker = new google.maps.Marker(myLatLng, { "title":
"Eken" });
map.addControl(new google.maps.LargeMapControl());
map.addControl(new google.maps.MapTypeControl());
map.setMapType(G_SATELLITE_MAP);
map.addOverlay(myMarker);
};
</script>
<title>My first Google Map</title>
</head>
<body>
<div id="map" style="width: 400px; height: 400px; margin: auto;
background-color: red">
This is where the map will soon appear.
</div>
</body>
</html>
//Tony
"Andrew Poulos" wrote in message
news:kICdnVv6kYTtPqDMnZ2dnUVZ_uWdnZ2d@westnet.com.au...
On 11/03/2013 8:05 PM, Tony wrote:
> This line
> google.load("maps", "2", { "other_params":"sensor=false" });
> cause in swedish
> "Körningsfel i JavaScript: google har inte definierats"
> and translated to english it it's
> runtime error in Javascript google has not been defined
>
> //Tony
>
>
>
> "Andrew Poulos" wrote in message
> news:xZKdnVv8dttDC6DMnZ2dnUVZ_rCdnZ2d@westnet.com.au...
>
> On 11/03/2013 6:36 PM, Tony wrote:
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:v="urn:schemas-microsoft-com:vml">
>> <head>
>> <meta http-equiv="content-type" content="text/html;
>> charset=utf-8"/>
>> <script type="text/javascript"
>> src="http://www.google.com/jsapi"></script>
>> <script type="text/javascript">
>> google.load("maps", "2", { "other_params":"sensor=false" });
>>
>> function init()
>> {
>> map = new google.maps.Map2(document.getElementById("map"));
>> var myLatLng = new google.maps.LatLng(58.135148,
>> 12.122726, true);
>> map.setCenter(myLatLng, 15);
>> var myMarker = new google.maps.Marker(myLatLng, { "title":
>> "Eken" });
>> map.addControl(new google.maps.LargeMapControl());
>> map.addControl(new google.maps.MapTypeControl());
>> map.setMapType(G_SATELLITE_MAP);
>> map.addOverlay(myMarker);
>> };
>> google.setOnLoadCallback(init);
>> </script>
>> <title>My first Google Map</title>
>> </head>
>> <body>
>> <div id="map" style="width: 400px; height: 400px; margin: auto;
>> background-color: red">
>> This is where the map will soon appear.
>> </div>
>> </body>
>> </html>
>
> Which line gives the error?
First, I would right my page as HTML 4 Strict, or HTML 5 (I think that
XHTML is now moot).
Secondly, it looks like IE 10 (which I don't have) is running your code
before its loaded whatever Google has at http://www.google.com/jsapi.
You might need some sort of loop that checks for the existence of the
Google objects or maybe wrapping your code in
window.onload = function() {
...
};
might help.
Andrew Poulos
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
problem with google map when using IE 10 "Tony" <tony.johansson@inport.com> - 2013-03-11 08:36 +0100
Re: problem with google map when using IE 10 Andrew Poulos <ap_prog@hotmail.com> - 2013-03-11 19:33 +1100
Re: problem with google map when using IE 10 "Tony" <tony.johansson@inport.com> - 2013-03-11 10:05 +0100
Re: problem with google map when using IE 10 Andrew Poulos <ap_prog@hotmail.com> - 2013-03-11 20:27 +1100
Re: problem with google map when using IE 10 "Tony" <tony.johansson@inport.com> - 2013-03-11 10:52 +0100
Re: problem with google map when using IE 10 "Tony" <tony.johansson@inport.com> - 2013-03-11 12:37 +0100
Re: problem with google map when using IE 10 "Tony" <tony.johansson@inport.com> - 2013-03-11 13:25 +0100
csiph-web