template::add_refresh_on_history_handler (public)

 template::add_refresh_on_history_handler

Defined in packages/acs-templating/tcl/head-procs.tcl

Register an event handler which will trigger a complete page refresh when we land on this page by accessing the browser's history (back and forward buttons). This is useful e.g. for those pages where some push interaction is happening and retrieving the page from the browser history would display it in an inconsistent state.

Partial Call Graph (max 5 caller/called nodes):
%3 test_templates_and_scripts templates_and_scripts (test acs-templating) template::add_refresh_on_history_handler template::add_refresh_on_history_handler test_templates_and_scripts->template::add_refresh_on_history_handler template::add_body_script template::add_body_script (public) template::add_refresh_on_history_handler->template::add_body_script xo::ChatClass instproc login xo::ChatClass instproc login (public) xo::ChatClass instproc login->template::add_refresh_on_history_handler

Testcases:
templates_and_scripts
Source code:
    # courtesy of: vasleo@gmail.com from Stack Overflow
    template::add_body_script -script {
        window.addEventListener( "pageshow", function ( event ) {
            var historyTraversal = event.persisted ||
            ( typeof window.performance != "undefined" &&
              window.performance.navigation.type === 2 );
            if ( historyTraversal ) {
                window.location.reload();
            }
        });
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: