后台返回的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