Using tampermonkey, how do I redirect using this website callback:…
- User
Using tampermonkey, how do I redirect using this website callback: https://loot-link.com/s?oiQO for this: mobile.codex.lol/?page=tasks&
- Assistant
Using tampermonkey, how do I redirect using this website callback: https://loot-link.com/s?oiQO for this: mobile.codex.lol/?page=tasks&
To redirect from mobile.codex.lol/?page=tasks& to https://loot-link.com/s?oiQO using Tampermonkey, you can create a simple userscript that detects when you're on the specified page and then redirects you to the desired URL.
Here’s how you can do it:
If you haven't installed Tampermonkey yet, you can download it for your browser from the following links:
Replace the default script contents with the following code:
// ==UserScript==
// @name Redirect mobile.codex.lol Tasks to Loot-Link
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Redirects from mobile.codex.lol tasks page to loot-link.com callback
// @author Your Name
// @match *://mobile.codex.lol/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Get the current URL
const currentURL = window.location.href;
// Check if the URL matches the specific page
if (currentURL.includes('mobile.codex.lol/?page=tasks&')) {
// Redirect to the desired URL
window.location.href = 'https://loot-link.com/s?oiQO';
}
})();
Explanation of the Script:
Metadata Block:
@name: The name of your userscript.@namespace: A unique identifier for the script. You can use your own URL or leave it as is.@version: The script's version number.@description: A brief description of what the script does.@author: Your name or alias.@match: Specifies the pages where the script should run. The wildcard * ensures it runs on any protocol (http or https) and any subpath under mobile.codex.lol.@grant: Specifies the permissions the script needs. none means it doesn't require special permissions.Script Functionality:
window.location.href.'?page=tasks&'). Adjust this string if your URL varies.https://loot-link.com/s?oiQO by setting window.location.href.Ctrl + S (Cmd + S on Mac).http://mobile.codex.lol/?page=tasks& (make sure the URL matches exactly).https://loot-link.com/s?oiQO.URL Matching: Ensure that the URL in the if condition exactly matches the URL you want to redirect from. If the URL can vary (e.g., additional query parameters), you might need to adjust the condition. For example, to ignore any additional parameters after ?page=tasks, you can modify the condition:
if (currentURL.startsWith('https://mobile.codex.lol/?page=tasks')) {
// Redirect code
}
Protocol Handling: If the site can be accessed via both http and https, ensure that the @match directive accounts for both by using * in the protocol position.
Debugging: If the redirect doesn't work as expected, you can add console.log statements to print out the current URL or any variables to the browser console for debugging.
Permissions: Since this script only requires access to modify the page you're on, and no special permissions are needed, we specify @grant none.
Trustworthy Sources: Only use scripts from sources you trust. Since you're writing this script yourself, ensure that the URLs you're redirecting to and from are safe and intended.
Adjusting the URL Conditions: If the URLs change or if you want to redirect additional pages, you can modify the if condition and @match directive accordingly.
Adding Multiple Redirects: If you need to handle multiple redirects, you can expand the script:
// Redirect Map
const redirects = {
'mobile.codex.lol/?page=tasks&': 'https://loot-link.com/s?oiQO',
'mobile.codex.lol/?page=home&': 'https://example.com/home',
// Add more mappings as needed
};
for (const [source, destination] of Object.entries(redirects)) {
if (currentURL.includes(source)) {
window.location.href = destination;
break;
}
}
Script Not Running: Ensure that Tampermonkey is enabled and that the script is active (check the status in the Tampermonkey dashboard).
URL Not Matching: Double-check the URLs in both the @match directive and the script logic to ensure they match the actual URLs you're visiting.
Conflicting Scripts: If you have other userscripts or extensions that affect the same site, they might interfere. Try disabling them temporarily to see if the redirect works.
By following these steps, you should have a working Tampermonkey script that redirects mobile.codex.lol/?page=tasks& to https://loot-link.com/s?oiQO whenever you visit the tasks page.
Not yet included in a published release.