via outerHTML
document.documentElement.outerHTML
via asynchronous request
$.get(window.location.href,function(res){ console.log(res); });
via jQuery
$("html").html();
The above is the detailed content of Example of JavaScript getting the source code of the current web page. For more information, please follow other related articles on the PHP Chinese website!