You need to call your detectBrowser function after the mapdiv is in
the DOM and ready to use.
Call the function after the mapdiv in your HTML like so:
<div id="map_canvas" style="width:100%; height:100%;"></div>
<script type="text/javascript">
detectBrowser();
</script>
Pete
On Mar 3, 10:08 am, DevAPI <[email protected]> wrote:
> I have seen that with this function I can know if the browser is an
> Iphone, an Android or an website.
> But how can I use this?
>
> I must modify this line: <div id="map_canvas" style="width:100%;
> height:100%"></div> ??
>
> ¿Any solution?
>
> Thanks ;)
>
> function detectBrowser() {
> var useragent = navigator.userAgent;
> var mapdiv = document.getElementById("map_canvas");
>
> if (useragent.indexOf('iPhone') != -1 ||
> useragent.indexOf('Android') != -1 ) {
> mapdiv.style.width = '100%';
> mapdiv.style.height = '100%';
> } else {
> mapdiv.style.width = '100px';
> mapdiv.style.height = '200px';
> }
>
> }
>
> </script>
> </head>
> <body style="margin:0px; padding:0px;" onload="initialize()">
> <div id="map_canvas" style="width:100%; height:100%"></div>
> </body>
> </html>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.