后台返回的HTML整个页面代码打开方法


后台返回的html代码片段,需要插入html标签中,而返回的整个html文档,则需要重写整个页面。

解决方法:

需要一个中转页面,用document.write()方法重写整个页面;


   
   
  
  
  1. // POST任意内容并跳转
  2. function StandardPost(html) {
  3. localStorage.removeItem( 'callbackHTML');
  4. localStorage.setItem( 'callbackHTML',html);
  5. window.location.href = window.location.href.split( '/pages/')[ 0] + '/pages/account/call_back.html';
  6. }

call_back.html 页面:


   
   
  
  
  1. <script>
  2. document.write(localStorage.getItem( 'callbackHTML'));
  3. document.close();
  4. </script>



免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM