View the history of a page via JavaScript in MediaWiki

I wish to view the history-webpage of certain MediaWiki webpages without the conventional button to do so (I’ve disabled that button in my website for aesthetic and SEO reasons).

I have expected that after disabling the MediaWiki View History built-in button and running this keypress JavaScript I’d access the revision history of webpages without a problem.

While this code pattern works for another type of management page-- edit (E), it doesn’t work for history (H) in MediaWiki 1.36.1 in Hebrew.

I get “אין פעולה כזו” (there’s no such action).

let domain = window.location.host;
let protocol = window.location.protocol;
let h1 = document.querySelector("h1");
window.addEventListener('keydown', function(event) {
    if (event.altKey && event.shiftKey && event.key === 'H') {
        window.location.href = `${protocol}//${domain}/index.php?title=${h1.innerText}&action=history`;
    }
});

credit to user:hkotsubo from Codidact for the code pattern.

Why doesn’t the code works for history pages and how to tackle this problem?

I couldn’t access the history due to having

$wgActions['history'] = false; # Complete history lockup;

In the web application root’s LocalSettings.php file.

After I have commented this command, I could access the history just fine.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.