Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save andersonbosa/24cfe32eb0bc9074c1e1ef4e1b5b9f5f to your computer and use it in GitHub Desktop.

Select an option

Save andersonbosa/24cfe32eb0bc9074c1e1ef4e1b5b9f5f to your computer and use it in GitHub Desktop.
// ==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)
@andersonbosa
Copy link
Author

andersonbosa commented Nov 20, 2023

with the script

image

without the script

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment