Ogum
Ogum

Reputation: 379

Reload a page using javascript inside a script

i'm using this script to block 3th part google scripts ( european cookies law)

It works but with some google maps scripts, after clicking "ok" to accept, i need to reload the page to see the map

<script src="cookies-enabler.js"></script>
<script>
    COOKIES_ENABLER.init({
        scriptClass: 'ce-script',
        iframeClass: 'ce-iframe',
        acceptClass: 'ce-accept',
        dismissClass: 'ce-dismiss',
        bannerClass: 'ce-banner',
        bannerHTML: '<p>Questa pagina usa cookies di terze parti. Per maggiori informazioni:<a href="privacy.php"> Privacy</a>&nbsp;&nbsp; Per continuare: '
                    +'<a href="#" class="ce-accept">'
                    +'Accetto i cookies'
                    +'</a>'
                    +'</p>',
        eventScroll: false,
        cookie: {
            name: 'ce-cookie',
            duration: 365
        },
        preventIframes: true
    });
</script>

How can i put some javascript code here to reload automatically the page on click?

   +'<a href="#" class="ce-accept">'

Thanks!

Upvotes: 1

Views: 70

Answers (1)

Magicprog.fr
Magicprog.fr

Reputation: 4100

With pure JS, just use the window.location.reload() method:

+'<a href="javascript: window.location.reload()" class="ce-accept">'

Upvotes: 1

Related Questions