Can I get the history.back() function to work in Chrome when using the file:// protocol?

前端 未结 5 1618
别那么骄傲
别那么骄傲 2021-01-08 00:41

I\'m building an application in an environment where I\'m restricted to using the local file system and a browser (i.e. running a server isn\'t an option). I have a generic

5条回答
  •  日久生厌
    2021-01-08 01:12

    For some reason in chrome, you have to add return false after calling history.go(-1)

    Change your function to:

    function goBack(evt) {
    // Check to see if override is needed here
    
    // If no override needed, call history.back()
    history.go(-1);
    return false;
    }
    

提交回复
热议问题