I have semi-successfully implemented the following Javascript, but am having some difficulties achieving cross-browser compatibility (specifically in Firefox) with window.performance.navigation
, since it has since been deprecated.
Here's what I've implemented, so far:
window.addEventListener("load",function(event){
var historyTraversal=event.persisted||
(typeof window.performance!=="undefined"&&
window.performance.navigation.type===2);
if(historyTraversal){
window.history.back();
}
});
Any alternative ways to formatting this?