Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- var back_to_url= "http://example.com/halaman-yang-muncul-jika-di-klik-back.html";//Ganti url ini
- var safe_bouncerate= true;
- function _createelements(){
- if(safe_bouncerate){
- var a=document.createElement('a');
- a.href=document.referrer;
- a.hostname;
- if(document.referrer !== undefined && document.referrer.length > 0 && a.hostname == window.location.hostname){
- safe_bouncerate = false;
- }
- }
- }
- (function() {
- if (!window.addEventListener)
- return;
- var blockPopstateEvent = document.readyState!='complete';
- window.addEventListener('load', function() {
- setTimeout(function(){ blockPopstateEvent = false; }, 0);
- }, false);
- window.addEventListener('popstate', function(evt) {
- if (blockPopstateEvent && document.readyState=='complete') {
- evt.preventDefault();
- evt.stopImmediatePropagation();
- }
- }, false);
- })();
- function executewhenclickback(){
- var rhash = '#forward';
- var currentUrl = window.location.href;
- _createelements();
- if(!safe_bouncerate) return;
- window.history.replaceState(null, null, currentUrl + rhash);
- window.history.pushState(null, null, currentUrl);
- window.addEventListener('popstate', function() {
- if (location.hash == rhash) {
- history.replaceState(null, null, location.pathname);
- location.replace(back_to_url);
- }
- });
- }
- executewhenclickback();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement