Ionic+AngularJS 开发的页面在微信公众号下显示不出来原因查究

ionic 页面 微信浏览器遇到的坑

公司的微信公众号一部分页面是用AngularJS+Ioinc开发,发现在本地浏览器测试的时候都没问题,传到服务器在微信公众号下跑就出问题来,经查是:

index-tab页面  406 not accessable http请求头问题

 1 $httpProvider.interceptors.push(function() {
 2         return {
 3             "request": function(config) {
 4                 //console.log(config.url);
 5                 if (config.url && config.url.lastIndexOf(".html") > 1) {
 6 config.headers["Content-Type"] = "text/html; charset=utf=8";
 7 config.headers["Accept"] = "*/*";
 8                 }
 9                 if (window.sessionStorage.getItem("sessionId")) {
10 config.headers[‘sessionId‘] = window.sessionStorage.getItem("sessionId");
11                 }
12                 return config;
13             },
14             "response": function(res) {
15                 if (res.config.url && !res.config.url.lastIndexOf(".html")) {
16 // console.log(res.data);
17 /*if (res.data.errorCode == ‘550‘) {
18    window.location.href = "#/weblogin";
19 }*/
20                 }
21                 return res;
22             }
23         }
24     });

上面的sessionStorage不是必须配置。

Ionic+AngularJS 开发的页面在微信公众号下显示不出来原因查究

原文:http://www.cnblogs.com/thomaspha/p/6535006.html

以上是Ionic+AngularJS 开发的页面在微信公众号下显示不出来原因查究的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>