Last active
November 20, 2023 13:19
-
-
Save andersonbosa/24cfe32eb0bc9074c1e1ef4e1b5b9f5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name whatsapp.com make web option available | |
// @match https://api.whatsapp.com/send/* | |
// @author github.com/andersonbosa < @t4inha > | |
// @description see more in: https://gist.github.com/andersonbosa/24cfe32eb0bc9074c1e1ef4e1b5b9f5f | |
// ==/UserScript== | |
// Function to update URL parameter | |
function updateURLParameter(param, value) { | |
const urlParams = new URLSearchParams(window.location.search); | |
urlParams.set(param, value); | |
const newURL = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + urlParams.toString(); | |
window.history.replaceState({ path: newURL }, '', newURL); | |
} | |
// Function to check and update "app_absent" parameter | |
function checkAndUpdateParameter() { | |
console.log('// @name whatsapp.com make web option available') | |
const urlParams = new URLSearchParams(window.location.search); | |
const appAbsentParam = urlParams.get('app_absent'); | |
if (appAbsentParam === '0') { | |
// Update the parameter to '1' | |
updateURLParameter('app_absent', '1'); | |
// Reload the page | |
location.reload(); | |
} | |
} | |
setTimeout(checkAndUpdateParameter, 500) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
with the script
without the script