Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

104 lines (69 sloc) 3.54 KB


Wiselinks makes following links and submitting some forms in your web application faster.

You may find Wiselinks similar to Turbolinks or Pjax, but Wiselinks have several rather important differences from both projects. We tried to make Wiselinks as easy to use as Turbolinks are but also as configurable as Pjax.


Wiselinks should work in all major browsers including browsers that do not support HTML History API out of the box.


Add this to your Gemfile:

gem 'wiselinks'

Then do:


Then modify your application.js or file to use Wiselinks object:

#= require jquery
#= require wiselinks

$(document).ready ->
    window.wiselinks = new Wiselinks()

Or more complex:

#= require jquery
#= require jquery.role
#= require wiselinks

$(document).ready ->
    window.wiselinks = new Wiselinks($('@content'))

        (event, url, target, render) ->        
            console.log("Wiselinks loading: #{url} to #{target} within '#{render}'")
            # start loading animation

        (event, data, status) ->        
            console.log("Wiselinks status: '#{status}'")
            # stop loading animation

        (event, data, status) ->        
            console.log("Wiselinks status: '#{status}'")
            # stop loading animation and show error message


While using Wiselinks you can rely on DOMContentLoaded or jQuery.ready() to trigger your JavaScript code, but Wiselinks gives you some additional useful event to deal with the lifecycle of the page:

page:loading (url, target, render = 'template')

Event is triggered before the XMLHttpRequest is initialized and performed.

  • url - URL of the request that will be performed;

  • target – element of the page where result of the request will be loaded into;

  • render = 'template' – what should be rendered; can be 'template' or 'partial';

page:success (data, status)

Event is triggered if the request succeeds.

  • data – the data returned from the server;

  • status – a string describing the status;

page:error (status, error)

Event is triggered if the request fails.

  • status – a string describing the type of error that occurred;
  • error – optional exception object, if one occurred;


We crafted small example application that uses Wiselinks so you can see it in action.

Note on Patches / Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.


Copyright (c) 2012 Igor Alexandrov, Alexey Solilin and Julia Egorova. See LICENSE for details.

Jump to Line
Something went wrong with that request. Please try again.