<!DOCTYPE html>

<html>
    <head>
        <title>storage</title>
    </head>
    <body>
        <script>

            if (!localStorage.getItem('counter')) {
                localStorage.setItem('counter', 0);
            }
            document.write(localStorage.getItem('counter'));
            localStorage.setItem('counter', parseInt(localStorage.getItem('counter')) + 1);

        </script>
    </body>
</html>