Jump to content

User:Varenc/common.js

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Varenc (talk | contribs) at 00:47, 31 October 2024. The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
console.log("Varenc common.js loaded")


function purgePageCache(page_title) {
	
	fetch(`https://en.wikipedia.org/w/index.php?title=${page_title}&action=purge`, {
	   method: "POST"
	})
	.then(response => {
	    if (response.ok) {
	        console.log(`Purge request successful: ${page_title}`);
	    } else {
	        console.log(`Purge request failed: ${page_title}`, response.status);
	    }
	})
	.catch(error => {
	    console.error(`Error making purge request on ${page_title}: `, error);
	});

}