Why does JavaScript only work after opening developer tools in IE once?

前端 未结 12 2074
予麋鹿
予麋鹿 2020-11-22 02:20

IE9 Bug - JavaScript only works after opening developer tools once.

Our site offers free pdf downloads to users, and it has a simple \"enter password to download\" f

12条回答
  •  清酒与你
    2020-11-22 02:29

    If you are using angular and ie 9, 10 or edge use :

    myModule.config(['$httpProvider', function($httpProvider) {
        //initialize get if not there
        if (!$httpProvider.defaults.headers.get) {
            $httpProvider.defaults.headers.get = {};    
        }    
    
        // Answer edited to include suggestions from comments
        // because previous version of code introduced browser-related errors
    
        //disable IE ajax request caching
        $httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
        // extra
        $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
        $httpProvider.defaults.headers.get['Pragma'] = 'no-cache';
    }]);
    

    To completely disable cache.

提交回复
热议问题