做多国语言网站,电子商务微网站制作,做绿色产品的网站,手机网站一键开发前端打开后端返回的 HTML格式 的数据#xff1a;
后端返回的数据格式如下示例#xff1a; 前端通过 js 方式处理#xff08;核心代码如下#xff09; console.log(回调, path); // path 是后端返回的 HTML 格式数据// 必须要存进localstorage#xff0c;否则会报错
后端返回的数据格式如下示例 前端通过 js 方式处理核心代码如下 console.log(回调, path); // path 是后端返回的 HTML 格式数据// 必须要存进localstorage否则会报错显示不完全window.localStorage.removeItem(callbackHTML)window.localStorage.setItem(callbackHTML, path)// 读取本地保存的html数据使用新窗口打开var newWin window.open(, _blank)newWin.document.write(localStorage.getItem(callbackHTML))// 关闭输出流newWin.document.close()
注如果后端返回的是一个网址则不使用这个方式可以使用 iframe / 标签在本地打开返回的网址示例如下
iframe :srcurlPath frameborder0 width100% :style{height: 100%} scrollingauto/iframe
iframe / 具体使用请参考