Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps API v3 BrowserIsCompatible

I'm updating some older code that used the v2 API for Google Maps. On domready, it would use a statement like

if(google.maps.BrowserIsCompatible()){
// load the map
}

Now that I'm loading the Google Maps API v3, I get an error

google.maps.BrowserIsCompatible is not a function

I've read a ton of threads in the Google v3 api groups, but haven't found a clear answer of what the new function is called or how to reference it.

like image 416
julio Avatar asked Aug 18 '10 23:08

julio


People also ask

How do you get bounds on Google Maps?

getBounds() in Google Maps API v3 But in API v3 you will get “bounds is undefined” error. So to get our latitude and longitude we need to move getBounds(), to some event listener. Description of bounds_changed in documentation is: “This event is fired when the viewport bounds have changed.”

What is the largest image size allowed in Static Maps API?

Static Maps images can be returned in any size up to 640 x 640 pixels. If you need images with sizes larger than 640 x 640 pixels (or 640 x 640640 x 640 pixels with a scale value of 2), follow these steps.

What does fitBounds do in Google Maps?

Sets the viewport to contain the given bounds. Note: When the map is set to display: none , the fitBounds function reads the map's size as 0x0, and therefore does not do anything. To change the viewport while the map is hidden, set the map to visibility: hidden , thereby ensuring the map div has an actual size.

How do you check if Google Maps API is loaded?

maps) {...} will give you a reference error if google is undefined (i.e. if the API didn't load). Instead, use if (typeof google === 'object' && typeof google. maps === 'object') {...} to check if it loaded successfully.


1 Answers

GBrowserIsCompatibile didn't make it into the version three API, so you will have to write this code yourself.

Here is a list of the browsers supported by v3.

like image 180
RedBlueThing Avatar answered Oct 14 '22 15:10

RedBlueThing