js获取当前网页的源码

  1. 通过 outerHTML
    document.documentElement.outerHTML
    
  2. 通过异步请求(完整源码,推荐)
    $.get(window.location.href,function(res){
       console.log(res);
    });
    
  3. 通过jQuery
    $("html").html();
posted @ 2021-08-29 21:06  zxh91989  阅读(1194)  评论(0编辑  收藏  举报