zoukankan      html  css  js  c++  java
  • 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不是必须配置。

  • 相关阅读:
    LA 3026 Period
    Touch
    Uva 11762 Race to 1
    清北学堂模拟赛d1t2 火柴棒 (stick)
    清北学堂模拟赛d1t1 位运算1(bit)
    常州模拟赛d8t2 绘画
    常州模拟赛d8t1 友好数对
    常州模拟赛d5t3 appoint
    常州模拟赛d7t1 亲戚
    常州模拟赛d7t3 水管
  • 原文地址:https://www.cnblogs.com/thomaspha/p/6535006.html
Copyright © 2011-2022 走看看