How to hide the login based on the URL, should not allow customer to login to access the login page set the key word “? mode-test “in the URL.

Using this Methode we can hide the login section based on the URL at the First stage, should not allow customer to login to access the login page for testing purpose, we need to setup an additional URL that contains the key word “? mode-test “in the URL.

used the script for  display block and none based on the url

var url = window.location.href;

    var loginOptions1 = document.getElementsByClassName("login-register-login-form")[0];

    var loginOptions = document.getElementsByClassName("login-register-login-form-fieldset")[0];

  
    if (url.includes("?mode-test")) {

        loginOptions.style.display = "block";

    } else {

        loginOptions.style.display = "none";

        loginOptions1.textContent = "Sorry, login is currently unavailable. We are still working on this feature.";

    }

Leave a comment

Your email address will not be published. Required fields are marked *