iframe显示微信公众号文章
iframe显示微信公众号文章vue + axios 解决微信图文防盗链方案let showSrc = 'https://cors-anywhere.herokuapp.com/'+微信公众号地址; //协议名根据实际情况决定this.$http.get( showSrc ).then((response)=>{let html = response.data;ht.
·
iframe显示微信公众号文章
vue + axios 解决微信图文防盗链方案
let showSrc = 'https://cors-anywhere.herokuapp.com/'+微信公众号地址; //协议名根据实际情况决定
this.$http.get( showSrc ).then((response)=>{
let html = response.data;
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;
let iframe = document.getElementById('iFrame');
iframe.src = html_src;
},(err)=>{console.log(err);});
更多推荐
已为社区贡献1条内容
所有评论(0)