Social Networks Script Embeds

A quick note for 3rd party common embeds in async ways.


Client Side Geolocation

I put up a post a couple weeks ago that I would post a javascript solution to device geolocation, opposed to server side device estimation. Well, here's the promised part two. Device geolocation using the W3C javascript navigator object.

Asynchronous Javascript Loading

Or, how to avoid third parties slowing down your site loads

Read a good article today at It's a Drupal article, but really, it's good practice to avoid third party scripts linked in the body no matter the platform. Here's the code:


Ajax Drupal Submenus

Our Seo department asked us to prevent the submenu items for the site's primary navigation from loading initially again, it had to be iframed or ajaxed in post load. I wanted a more standard solution to the issue, something I could safely reuse on multiple Drupal sites.

I used our custom module for the site to output a new block 'Custom Main Menu' that I used to replace the default main menu. It added a small dependency to menu_block, but that's an awesome module anyway, and I'm happy to rely on it. The new main menu loads as normal for users that are logged in. For anonymous users, it loads the first level of the main menu, then request ajax requests the rest after page load, replacing the entire menu block with the full menu again to avoid flashing or complex replacements.


Subscribe to RSS - javascript