Angular JS not working with IE9 but works with other browsers

后端 未结 2 657
眼角桃花
眼角桃花 2020-12-10 09:24

So I am working on a small app that gets that from an API url like so... $http.get(s_url) .then(function(res) {... My app works well with chrome,safari,opera

2条回答
  •  -上瘾入骨i
    2020-12-10 09:50

    I had a similar issue. The page would load properly, calling angular to populate a table. subsequent clicks on a refresh button should recall the fetching method, but were ignored by the browser.

    The resolution was to add content expiry headers expiring 5 seconds in the past, and then IE would execute the Angular scripts.

    EDIT:

    How to implement

    The headers to add are specified in the HTTP specification.

    I have printed a fixed timestamp here. You can of course set the date explicitly using date/time functions

    Depending on which language you are using, and which webserver yuo are hosted on, there are different ways to do this:

    .htaccess file:

    
       Header set Cache-Control "max-age=0, public"
       Header set Expires "Thu, 01 Dec 1994 16:00:00 GMT"
    
    

    -note both shouldn't be necessary

    if you are using php:

    
    

    if you are using jsp:

    <% 
       response.setHeader("Cache-Control: max-age=0, public");
    %>
    

提交回复
热议问题