js获取当前网页的源码

  1. 通过 outerHTML
    document.documentElement.outerHTML
    
  2. 通过异步请求(完整源码,推荐)
    $.get(window.location.href,function(res){
       console.log(res);
    });
    
  3. 通过jQuery
    $("html").html();
原文地址:https://www.cnblogs.com/zxh1919/p/15203621.html