Since this topic has come up more than once, I documented all of these suggestions on my blog:
http://blogs.missouristate.edu/web/2010/05/12/google-maps-api-v3-developing-for-mobile-devices/ Chad Killingsworth On May 12, 12:03 pm, Jack Berberette <spin...@gmail.com> wrote: > Thanks Chad, > > I added: > > document.addEventListener('DOMContentLoaded', function () { > var element = document.createElement('script'); > element.src = > 'http://maps.google.com/maps/api/js?sensor=true&callback=Initialize'; > element.type = 'text/javascript'; > document.body.appendChild(element); > }, false); > > Seems to load fine...thanks...Jack > > On Wed, May 12, 2010 at 12:44 PM, Chad Killingsworth < > > > > > > chadkillingswo...@missouristate.edu> wrote: > > Here's a simplified version with comments: > >http://search.missouristate.edu/map/mobile/examples/bestpractices.aspx > > > Chad Killingsworth > > > On May 12, 10:53 am, Jack Berberette <spin...@gmail.com> wrote: > > > Hi Chad, > > > > I was looking at your code and am trying to figure out the > > DOMContentLoaded > > > piece. My map is very simple so I couldn't figure out how to implement > > this > > > based on my code athttp://www.gamecarver.com/viperapp.html. I looked at > > > your source but couldn't follow very well....kind of over my head. > > > > I also fixed the DIV tags based on the article you sent (BIG thanks for > > > that:) and I used the Closure Compiler mentioned on your blog. That link > > is > > > here:http://www.gamecarver.com/vipercss.html > > > > Thanks, > > > > Jack > > > > On Wed, May 12, 2010 at 11:02 AM, Jack Berberette <spin...@gmail.com> > > wrote: > > > > Thanks so much Chad! I'm fixing the <div>s now....I was wondering how > > to > > > > do that :) > > > > > I'm also going to go step by step and implement your > > suggestions...thanks > > > > for taking the time to help me :) > > > > > I'll definitely checkout PageSpeed too!! > > > > > I'll keep ya up to date as I make progress....thanks again! > > > > > Jack > > > > > On Wed, May 12, 2010 at 10:34 AM, Chad Killingsworth < > > > > chadkillingswo...@missouristate.edu> wrote: > > > > >> Oh and one more thing: learn to use and love Google Page Speed > > (http:// > > > >> code.google.com/speed/page-speed/). > > > > >> Chad Killingsworth > > > > >> On May 12, 9:25 am, Chad Killingsworth > > > >> <chadkillingswo...@missouristate.edu> wrote: > > > >> > It really depends on what your goals are. My goal is to present the > > > >> > user with an interface as fast as possible and then progressively > > add > > > >> > functionality. With that in mind, here's some suggestions: > > > > >> > 1) Dynamically add the maps API on the DOMContentLoaded event. In > > this > > > >> > way, your basic HTML elements will show up first. You'll need to add > > a > > > >> > callback parameter to the maps api script source in order to call > > your > > > >> > initialization function. > > > > >> > 2) In your initialize function, initialize the map only. Don't add > > any > > > >> > layers. Attach an event callback to the "tiles_loaded" event of the > > > >> > map to further customize it (use the addListenerOnce method). > > > > >> > 3) In your tiles_loaded callback, add your custom layers. Also move > > > >> > your geolocation code here as well. Currently, the map isn't loading > > > >> > until the location data comes back - and that's SLOW. > > > > >> > 4) Implement the offline storage mentioned here: > > > >>http://googlecode.blogspot.com/2010/04/google-apis-html5-new-era-of-m. > > .. > > > >> > - it makes a big difference for return visitors. There are a couple > > of > > > >> > gotcha's with this though. Realize that EVERY resource/url you > > access > > > >> > must be specified in the manifest file in some way. > > > > >> > One more suggestion not related to speed; use this technique to set > > > >> > the map size: > > > >>http://www.alistapart.com/articles/conflictingabsolutepositions/ > > > >> > In this way your map will always be 100% of the screen size (even on > > > >> > rotation) and still leave room for your header and footer. > > > > >> > You can see an example of all of these techniques athttp:// > > > >> search.missouristate.edu/map/mobile/ > > > > >> > Chad Killingsworth > > > > >> > On May 12, 8:48 am, Jack Berberette <spin...@gmail.com> wrote: > > > > >> > > Hello Everyone, > > > > >> > > Is it possible to pre-load or somehow speed up the layers being > > called > > > >> into > > > >> > > the map? With the AWESOME peoepl from this group, I have my map > > up > > > >> and > > > >> > > running and am now bringing it in to an iPhone app. It loads in > > the > > > >> iPhone > > > >> > > but very slowly. > > > > >> > > I have used Closure Compiler here: > > > >>http://www.gamecarver.com/compressed.htmlandthatseemedtohelp a > > > >> > > little > > > > >> > > Here's the main map file:http://www.gamecarver.com/viperapp.html > > > > >> > > Thanks, > > > > >> > > Jack > > > > >> > > -- > > > >> > > 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 > > > >> google-maps-js-api...@googlegroups.com. > > > >> > > To unsubscribe from this group, send email to > > > >> google-maps-js-api-v3+unsubscr...@googlegroups.com<google-maps-js-api-v3%2B > > > >> unsubscr...@googlegroups.com><google-maps-js-api-v3%2B > > unsubscr...@googlegroups.com> > > > >> . > > > >> > > For more options, visit this group athttp:// > > > >> groups.google.com/group/google-maps-js-api-v3?hl=en. > > > > >> > -- > > > >> > 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 > > > >> google-maps-js-api...@googlegroups.com. > > > >> > To unsubscribe from this group, send email to > > > >> google-maps-js-api-v3+unsubscr...@googlegroups.com<google-maps-js-api-v3%2B > > > >> unsubscr...@googlegroups.com><google-maps-js-api-v3%2B > > unsubscr...@googlegroups.com> > > > >> . > > > >> > For more options, visit this group athttp:// > > > >> groups.google.com/group/google-maps-js-api-v3?hl=en. > > > > >> -- > > > >> 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 > > > >> google-maps-js-api...@googlegroups.com. > > > >> To unsubscribe from this group, send email to > > > >> google-maps-js-api-v3+unsubscr...@googlegroups.com<google-maps-js-api-v3%2B > > > >> unsubscr...@googlegroups.com><google-maps-js-api-v3%2B > > unsubscr...@googlegroups.com> > > > >> . > > > >> For more options, visit this group at > > > >>http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > > > > PR: wait... I: wait... L: wait... LD: wait... I: wait... wait... > > Rank: > > > > wait... Traffic: wait... Price: wait... C: wait... > > > > PR: wait... I: wait... L: wait... LD: wait... I: wait... wait... > > Rank: > > > wait... Traffic: wait... Price: wait... C: wait... > > > PR: wait... <javascript:{}> I: wait... <javascript:{}> L: > > > wait...<javascript:{}> LD: > > > wait... <javascript:{}> I: wait... <javascript:{}>wait... <javascript:{}> > > Rank: > > > wait... <javascript:{}> Traffic: wait... <javascript:{}> Price: > > > wait...<javascript:{}> C: > > > wait... <javascript:{}> > > > > -- > > > 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 > > google-maps-js-api...@googlegroups.com. > > > To unsubscribe from this group, send email to > > google-maps-js-api-v3+unsubscr...@googlegroups.com<google-maps-js-api-v3%2B > > unsubscr...@googlegroups.com> > > . > > > For more options, visit this group athttp:// > > groups.google.com/group/google-maps-js-api-v3?hl=en. > > > -- > > 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 > > google-maps-js-api...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-maps-js-api-v3+unsubscr...@googlegroups.com<google-maps-js-api-v3%2B > > unsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > PR: wait... <javascript:{}> I: wait... <javascript:{}> L: > wait...<javascript:{}> LD: > wait... <javascript:{}> I: wait... <javascript:{}>wait... <javascript:{}> > Rank: > wait... <javascript:{}> Traffic: wait... <javascript:{}> Price: > wait...<javascript:{}> C: > wait... <javascript:{}> > > -- > 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 google-maps-js-api...@googlegroups.com. > To unsubscribe from this group, send email to > google-maps-js-api-v3+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/google-maps-js-api-v3?hl=en. -- 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 google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.