<html>
<head>
</head>
<body>
<script>
if(localStorage.getItem('userName') == undefined) {
var a = prompt("Ваше имя?");
localStorage.setItem('userName', a);
}
if(document.location.pathname != '/index.html') top.location = 'index.html';
document.write('Дорогой '+localStorage.getItem('userName')||'друг'); // для index.html
</script>
</body>
</html>