码迷,mamicode.com
首页 > 微信 > 详细

app中嵌套微信公众号文章链接

时间:2018-07-27 21:10:30      阅读:331      评论:0      收藏:0      [点我收藏+]

标签:oca   ajax   res   ref   frame   protoc   ext   cat   app   

        if (article && article.RefferID) {
            $.ajaxPrefilter(function (options) {
                if (options.crossDomain) {
                    let http = (window.location.protocol === ‘http:‘ ? ‘http:‘ : ‘https:‘);
                    options.url = http + ‘//cors-anywhere.herokuapp.com/‘ + options.url;
                };
            });

            let showSrc = article.SourceUrl;//链接地址
            $.get(showSrc, function (response) {
                let html = response;
                // 确保图片显示
                html = html.replace(/data-src/g, "src").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/g, ‘‘).replace(/https/g, ‘http‘);
                let html_src = ‘data:text/html;charset=utf-8,‘ + html;
                $(‘#iframe‘).attr("src", html_src);
            });
        }

 

app中嵌套微信公众号文章链接

标签:oca   ajax   res   ref   frame   protoc   ext   cat   app   

原文地址:https://www.cnblogs.com/sjw-dmwz/p/9379194.html

(1)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!