B
B
BonBon Slick2019-02-01 17:26:18
iPhone
BonBon Slick, 2019-02-01 17:26:18

IOS design loaded from cache when user presses BACK?

Click on the button, search in the search form
Deactivate the button to avoid another request

// automatically disable submit buttons
    $('form').submit(function () {
        // ignore if has 'special' class
        if ($(this).hasClass('can-submit-again')) {
            return;
        }

        // find submit button
        var btn = $(this).find('input[type="submit"], button[type!="button"]');

        // set spinner
        $(btn).css('min-width', $(btn).innerWidth());
        $(btn).html('<i class="fa fa-spinner fa-pulse fa-fw" aria-hidden="true"></i>');
        $(btn).attr('disabled', 'disabled');
    });

We see the search result The
user decided to go back and pressed the BACK button in the iPhone UI
The button is still disabled, which means that the page was loaded from the cache and not reloaded as it should.
Tested on different *** backgrounds 6-7-8 and android, galaxy 7-8-9, the bug is exclusively ** background, as usual.
How to screw it up now?
None of this helped, because the script is also loaded from the cache, and the method will no longer be called for the redirect, since the old value is there.
// check if user used return button, reload page to update cache
    let $pageIsDirty = $('#page_is_dirty');
    function checkIfDirty(){
        if ('1' === $pageIsDirty.val()) window.location.reload();
    };
    function markPageDirty() {
        $pageIsDirty.val('1');
    }
    (checkIfDirty()); //  второй раз ети методы уже не будут вызваны
    markPageDirty();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question