Turbolinks: what is the Rails 4 way of showing progress for slow pages?
Asked Answered
K

1

9

This question might sound similar to Rails turbolinks long request doesn't show page load.

I've recently started new Rails 4 application, which uses Turbolinks library by default - it is awesome: makes the application feel faster/snappier, however I do have some pages that are slower than others.

Unfortunately I can't find a good way to make a browser show the default loading indicator - just like it does when it loads "conventional" web pages. People recommend different JavaScript solutions, for example, https://github.com/caarlos0/turbolinks_transitions. Although some do look good, but "average internet user" is not used to seeing loading progress somewhere other than the default browser's loading indicator.

  • How can I make Chrome show that "spinning semi-circle" in the tab header?
  • Or how can I make Safari show that "moving blue wave" in the address bar?
  • Etc.

Most of my pages are fast though, so I'd like to show this loading indicator for the pages that won't load within 300 ms, for example.

Thank you! Alex.

Kerch answered 27/9, 2013 at 3:24 Comment(2)
Here is what I do: gist.github.com/cpuguy83/5016442Mack
That's a great answer and worked fine for me: https://mcmap.net/q/612450/-how-to-create-a-youtube-style-loading-bar-with-rails-4-39-s-turbolinksFranconia
V
8

While this isn't exactly what you want, you can change the cursor to be the loading cursor using javascript like this.

$('selector').css( 'cursor', 'wait' );

It would definitely let users know that a page is loading. You can set/remove it with more javascript

Veda answered 29/10, 2013 at 16:44 Comment(1)
That's a great and yet very simple idea - thank you, TMP! This would probably eliminate 1/2 of my users confusion. Sorry, not marking your answer as "accepted", because the question about how to make Chrome/Firefox/IE show page loading indicator remains open. Maybe I should talk to browser makers about that... :)Kerch

© 2022 - 2024 — McMap. All rights reserved.