iCloud Beta Redirect

Automatically redirect www.icloud.com to beta.icloud.com.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         iCloud Beta Redirect
// @version      1.1
// @author       SpotlightForBugs
// @description  Automatically redirect www.icloud.com to beta.icloud.com.
// @match        *://www.icloud.com/*
// @run-at       document-start
// @namespace    https://greasyfork.org/en/users/1412746-spotlightforbugs
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to check if the URL matches the target pattern
    function checkURL(url) {
        return url.startsWith('https://www.icloud.com');
    }

    // Function to convert the URL to the beta subdomain
    function newURL(url) {
        return url.replace('www.icloud.com', 'beta.icloud.com');
    }

    // Perform the redirection if the current URL matches
    if (checkURL(window.location.href)) {
        window.location.replace(newURL(window.location.href));
    }
})();