Posts Tagged: javascript

Center a Google Map on a point

I’ve always been surprised that centring on a point/LatLng isn’t a function in the Google Maps API, although the fitBounds method does tend to interfere with the zoom it’s a useful tool to have in the box.

AngularJS Karma testing

Last year I was involved in making a prototype web app using AngularJS, and as it there was the possibility that it may end up as the foundation to production code we wrote unit tests for it’s internal functionality. Whilst there is a ton of examples for testing AngularJS apps we still ran into a… Read more »

Using MarkerClusterer and MarkerWithLabel with Google Maps

Both MarkerClusterer and MarkerWithLabel are great libraries, but they do have their quirks; MarkerClusterer What is a cluster marker? MarkerClusterer doesn’t use Google Markers or pin styles, it takes an image path and creates HTML on a layer. The resultant markup is given a class of ‘cluster’ that you can target in your CSS. Do… Read more »

Using jQuery.ajax rather than jQuery.load

jQuery.load is an incredibly useful method, but if you want to do more with the returned source than put it into a div then you may want to use jQuery.ajax directly with your own callback. The source code for the load method is a great starting point for writing your own callback, in particular how… Read more »

iOS 7 and 412 precondition failed

With every release of iOS there tend to be some gremlins lurking in Safari, iOS 7 was no different. When first testing the site I’ve been building in iOS 7 I was getting a failure when resubmitting an AJAX POST request, the response was 412 (Precondition Failed). Eventually I found this issue explained related to… Read more »

Using Bing Maps with Require.js

Recently I’ve been doing quite a lot of work with Bing Maps. Not every page on the site requires the map API so we’ve been attempting to use require.js, which we already have, to maintain that dependancy. As usual it’s more complicated than we’d hoped. Bing Maps provides a callback hook that we can use… Read more »

An alternative to jQuery.load

Note: Are you looking to use jquery.ajax rather than jquery.load? Click here. The post below talks about using an iFrame as an alternative to AJAX. A very long time ago, 2010 maybe, I was asked to build a site with an “app like feel”, which seemed to mean “we don’t like page refreshes”. At the… Read more »

Mediaelement.js Flash fallback pain.

Recently I’ve been working a lot with mediaelement.js, much more than I’d hoped to have to have done with a module that promises so much. The biggest issue I faced was changing the video src in the Flash fallback player as when you change the source the new video isn’t loaded until it is played…. Read more »

Making session storage play nicely with server side sessions

Session and local storage have made the storage of data on a clients machine respectable, gone are the big cookies and, partnered with the ability to define manifest files developers can now exert control over how resources and data are cached to a level that makes Apache and IIS look embarrassing. However, with every… Read more »

Hashbangs, useful, but probably not what you want

In the modern web AJAX is the workhorse behind the interactions. CSS3 might add the shine but AJAX is still doing the work. The strength of AJAX is that it’s a background request, the UI will ignore them completely, which is fantastic unless you’ve just ripped out the hole page content and replaced it with… Read more »