Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- var stack = [];
- window.onpopstate = function(){ //для ие8-9 будут прямые переходы
- var c = (stack.pop()); //JSON.stringify
- stack.push({'content': document.querySelector('content').innerHTML});
- document.querySelector('content').innerHTML = c['content'];
- }
- function ClickWeb(elem, e){
- stack.push({'content': document.querySelector('content').innerHTML}); //сохраняем все данные со страницы
- history.pushState(null, null,'/web');
- document.querySelector('content').innerHTML = '<a href="/">Web2</a>';
- }
- </script>
- <style>
- </style><!--@import url(style.css);-->
- <meta>
- <title> </title>
- </meta>
- </head>
- <body>
- <content>
- <header>
- <h1 id=header>This is index page</h1>
- </header>
- <p>
- Welcome to <a href="/web">Web1</a> with refresh
- </p>
- <p>
- Welcome to <b href="/web" onclick='ClickWeb(this, event);' style='cursor: pointer;color:red;'>Web1</b> without refresh
- </p>
- </content>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement