Determine whether javascript: history.go (-1) exists?

Take away simple and clear examples!

if (document.referrer==""){
window.location.href = "/app/index.php?i=5&c=entry&do=cover&m=ruyi_mobile&op=success";
}else{
window.history.go( - 1);
return;
}

Remarks: You can only judge whether document.referrer is empty! history.length judges that you have visited several pages, not whether there is currently a previous page!

Guess you like

Origin www.cnblogs.com/WZH75171992/p/12758749.html