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不是必須配置。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM