Last Updated: February 25, 2016
·
1.078K
· restlessdesign

“Rocket Sauce”

Give your pages the illusion of speed by hiding content on the current page before the next page request comes through. Try running the snippet below from your console (works on this page).

window.onbeforeunload = function() {
    // Alternately, set a class on a collection 
    // of elements that you wish to hide.
    $('#clrpsa').css('opacity', 0);

    // Use when navigating to pages with the same header
    window.scroll(0, 0);
}

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside