With Angularjs, $http post return response error in Microsoft Edge -
well, while develop admin page test,
a weird problem occurred in microsoft edge.
here's part of source code fetch response server of loginctrl.js
$http({ method: 'post', url: define.apiurl + 'admin/login', data: { user_id: $scope.login_email, password: $scope.login_password } }) .then(function (response) { if (response.data.success) { $cookiestore.put(define.userinfo, response.data.info); $cookiestore.put(define.usertoken, response.data.token); } }, function (data) { console.log('errors!'); console.log(data); });
this works in chrome , ie
but in microsoft edge, returns error below
data = null status = -1 statustext = ""
and below each status of related files.
# loginctrl.js ## chrome response status accept-ranges:bytes cache-control:public, max-age=0 connection:keep-alive content-length:1877 content-type:application/javascript date:fri, 18 aug 2017 04:06:49 gmt etag:w/"755-15df385a23e" last-modified:fri, 18 aug 2017 04:06:47 gmt ## chrome request status accept:'*/*' accept-encoding:gzip, deflate, br accept-language:ko-kr,ko;q=0.8,en-us;q=0.6,en;q=0.4 connection:keep-alive host:localhost:9000 if-modified-since:fri, 18 aug 2017 02:51:00 gmt if-none-match:w/"6f5-15df340413d" referer:http://localhost:9000/ user-agent:mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/60.0.3112.101 safari/537.36 ## edge response status accept-ranges: bytes cache-control: public, max-age=0 connection: keep-alive content-length: 1807 content-type: application/javascript date: fri, 18 aug 2017 02:06:14 gmt etag: w/"70f-15df3173adf" last-modified: fri, 18 aug 2017 02:06:12 gmt ## edge request status accept: application/javascript, '*/*'; q=0.8 accept-encoding: gzip, deflate accept-language: ko-kr connection: keep-alive host: localhost:9000 referer: http://localhost:9000/ user-agent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/52.0.2743.116 safari/537.36 edge/15.15063
i wonder why edge cannot right responses.
i tried make headers 'content-type', 'cache-control' or add config cache : false.
but these couldn't fix problem.
did miss something??
plz handsome or pretty programmer save me
microsoft edge improves networking performance caching resources downloaded via cors-enabled xhr operations in same manner if had been downloaded directly. previously, under many circumstances, caching disabled such items. new behavior allows more resources loaded local disk on subsequent requests, reducing network use , improving load times.
basically in edge data received api when first access page , if revisit page or reload page data received cache.
as solution suggest generate unique value , add request query string, way every request unique , not cached. unique value can random number or unix timestamp , ... after generate random value need append url, example this
url: define.apiurl + 'admin/login?rand=123243546',
Comments
Post a Comment