Categories
Rails

Using Javascript links with Turbolinks for Ruby on Rails 4.x

This was hard to find by Googling it, so I’ll put it into a blog post here. Turbolinks is a great page speed optimization technology that is built into Rails 4.

With Turbolinks, every page load simply replaces the HTML body tag with the contents of the next page, which means that your CSS and Javascript don’t have to be loaded again (even from cache) and then parsed.

Rails does some magic to your HTML links (basically by installing a jQuery event handler for opening links) so that this works. But what if you’re just using standard Javascript? For instance, I’m using Bootstrap Table for my admin interface, with rows of data. Clicking on a row will take me to that detail page. With window.open(), that forces a full refresh.

Instead, use Turbolinks.visit() with the URL you need to open, and your Rails 4 app will feel a lot quicker to your users.

Categories
Phonegap Twilio Uncategorized

Twilio Client PhoneGap plugin updated to support Twilio Client SDK 1.2 for Android and iOS

I just updated the Twilio Client for PhoneGap plugin: https://github.com/jefflinwood/twilio_client_phonegap to support the latest version of Twilio’s client SDKs for both iOS and Android.

For those of you who wonder why you might need these, the native browsers for iOS and Android don’t support the technology used in the Twilio Client SDK for JavaScript, so if you want to build voice-enabled mobile applications, you will need to create native applications. You could develop these in Objective-C or Swift for iOS, or in Java for Android, or go with a cross-platform solution like Xamarin or Cordova/PhoneGap.

Cordova/PhoneGap lets you use HTML5/CSS/Javascript to build your mobile applications, and while it’s not the right choice for every application, it’s certainly one solution. The Twilio Plugin for PhoneGap lets you use the native Twilio Client SDK’s from JavaScript, with a syntax that is very close to the Twilio Client for JavaScript syntax.