Load a window only once after reloading the site in asp.net C #

0

Having this window whenyoufirstaccessawebsite,howdoIonlyappearonceevenafterI'vereloadedthewebsite,ordoIreturntothehomepageandnotshowupagain?

<inputtype="radio" id="rd">
    <div class="bg">
        <div class="box">
            <p class="p1">Bem-vindo</p>
            <p class="p1">á</p>
            <p class="p1">DOMO® Portugal</p>
            <p class="p2">Tornamos o seu sonho realidade</p>
            <label for="rd">Visitar</label>
        </div>
    </div>

I have searched something about localstorage but I do not understand how it is done.

EDIT:

I've already figured out the solution to this question: link

    
asked by anonymous 18.05.2018 / 17:39

1 answer

0

You can use sessionstorage , it will have value until the user closes the browser, after that it will be destroyed

    $(function() {  
        var deveExibirModal = sessionStorage.getItem('deveExibirModal');        
        if(deveExibirModal != undefined && deveExibirModal != "nao"{ 
            $( "#dialog-modal" ).dialog({
                height: 140,
                close: function( event, ui ) {
                    sessionStorage.setItem('deveExibirModal', 'nao');               
                }
            });
        }
    });

Now if you want to control this in a different way there is localstorage its value will only be destroyed by code or if the user cleans or uninstalls the browser

$(function() {  

    var dataVencimento = localStorage.getItem('dataVencimento');

    if(dataVencimento < hoje)
    {
        localStorage.removeItem("deveExibirModal");
        localStorage.removeItem("dataVencimento");
    }       

    var deveExibirModal = localStorage.getItem('deveExibirModal');

    if(deveExibirModal != undefined && deveExibirModal != "nao"{ 
        $( "#dialog-modal" ).dialog({
            height: 140,
            close: function( event, ui ) {
                localStorage.setItem('deveExibirModal', 'nao');
                localStorage.setItem('dataVencimento', 'sua_data');
            }
        });
    }
});

You can read more about documentation

    
18.05.2018 / 18:14