We used to load Google Map key with JavaScirpt embed in JSP.
The Google map is used in the second page (search result page) once user click map view.
The speed is highly depended on network condition and Google map server. Sometime, it would slow down the page load.
We do not like to slow down the speed to load home page.
So we use Google AjaxLoader to load Google Map Key on demand on hotel search result page.
Following is the code example:
boolean isSecure = assign the value based on whether the request is secure or not.
AjaxLoader.init(null, isSecure);
AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
options.setOtherParms("sensor=false&client=ourclientid&oe=utf-8");
AjaxLoader.loadApi("maps", "2", new Runnable() {
public void run() {
mapsLoaded();
}
}, options);
Where mapsLoaded() is call back function to display Google map with customized token.
Note: There is an issue with secure request, IE will pop up secure/non-secure warning.
I posted workaround with http://code.google.com/p/gwt-google-apis/issues/detail?id=283
Change History:
Author: Michael Wang, initial draft
No comments:
Post a Comment