Smart App Banners + Squarespace pages by Paulo Fierro

Smart App Banners have been around since iOS 6 and are an easy way for websites to link to apps on the App Store. As app promotion methods go, these are intelligent and not as obtrusive as other methods.

To add them to your page you have to add a meta tag to the head of each page where you want the banner to appear. I wanted to add a banner to our Avoid Town page but on Squarespace you don't have access to the raw HTML. However you can provide custom Javascript.

First go to the page you want the banner to appear on and click on the gear icon to access the page's settings.

Screen Shot 2015-07-13 at 18.18.49.png

Now click on Advanced at the top right of the page and you'll be presented with a textarea where you can enter code to be injected into the page.

Next paste in the code below, replacing XXX with your app's ID and YYY with your iTunes affiliate ID (or leave it blank).

You can find your app ID using the iTunes Link Maker and if you haven't you should join the iTunes Affiliate Program.

Disabling callouts in WKWebView by Paulo Fierro

A few months back I wrote about disabling the ability of a user to zoom a web page presented in a WKWebView. This is custom HTML content being displayed in an enterprise app, not a web site, so its not as nefarious as it sounds.

Another wish was to disable callouts. That's the pop-over that shows up when you long-tap on elements in Mobile Safari. They let you copy text, define a word or share a snippet.

A callout on iPad

A callout on iPad

There's no property on WKWebView that lets us do this, but we can do this similar to how we disabled the ability to zoom the page.

We pass a custom WKUserScript to our web view which creates a style tag and adds some styling which sets both -webkit-user-select and -webkit-touch-callout to none on all elements except input fields and textarea elements.

As always, remember that these powers should only be used for good.

Enabling SSL on SQUARESPACE by Paulo Fierro

In 2014 Google made an announcement stating they would boost sites using HTTPS encryption in search results. Apart from that there are several other great reasons for using HTTPS. This site is hosted on Squarespace and while you could access this via a subdomain, I prefer using my actual domain that I own and control.

After some searching I came across this excellent blog post describing how to get SSL for your Squarespace site using CloudFlare. Its fairly straightforward to set up and doesn't cost a thing.

Introducing Avoid Town by Paulo Fierro

Today we launched Avoid Town for iPhone, which easily lets you know how busy downtown is going to be on a particular day based on the number of cruise ships and passengers that will be arriving.

Avoid Town was made for people living and working on Grand Cayman where lots of ships also means lots of traffic. Check the app before you leave and you’ll be surprised by how much time you save.

Building the app, shooting and editing the promo and putting everything together for launch has been great fun and we've learned a ton.

Hopefully you'll find the app to be as useful as we do :)

Disabling magnification in WKWebView by Paulo Fierro

On a current project we're using the newly introduced (in iOS 8) and mostly awesome WKWebView to show custom HTML content. Now for some very specific reasons I can't get into, we need to disable the pinch-to-zoom gesture for all the pages that are displayed.

Luckily WKWebView has an allowsMagnification property to do just this, but unfortunately this and the other properties that allow you to modify the magnification are only available on OS X.

But all is not lost, we can attach our own custom Javascript to any page that we load. And with a little help from Javascript we can create a meta tag that disables scaling of the viewport and inject it into the document's <head>.

Once we have this Javascript we can create a WKUserScript object which we tell the WKUserContentController to always inject into loaded pages, and pass that controller to a WKWebViewConfiguration object, which is used when we create our WKWebView.

That sounds like a mouthful but its quite straightforward. Paste code the code below into a UIViewController's viewDidLoad method to try it out.

UPDATE: Initially I had written that we were loading arbitrary content from around the web which wasn't strictly the case and also caused a few people to suggest that this was a bad thing. Absolutely 100% agree. However in this specific case we are loading custom content, produced in-house and requires the gesture to be disabled.

Otherwise you probably should never do this.

And the same thing in Swift for funsies: