Answer the question
In order to leave comments, you need to log in
How to execute the past function on clicking back in the browser?
Basically, there is this code:
.d-none {display:none}
<div id="main">Index page</div>
<div id="faq" class="d-none">Index page</div>
<li><a href="/" onclick="mainh()">Главная</a></li>
<li><a href="/faq" onclick="faqh()">FAQ</a></li>
function mainh(){
$('#main').removeClass('d-none');
$('#faq').addClass('d-none');
event.preventDefault();
history.pushState(null, null, '/');
$('title').text('NameSite - Index');
}
function faqh(){
$('#main').addClass('d-none');
$('#faq').removeClass('d-none');
event.preventDefault();
history.pushState(null, null, '/faq');
$('title').text('NameSite - FAQ');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question