如何处理open.view源的window.open(“ view-source:” + window.location.href,'_blank')

时间:2019-08-17 04:50:01

标签: javascript view-source

我想使用浏览器打开“查看源代码”

为什么不允许这样做?

**window.open("view-source:" +window.location.href, '_blank');**

<script>
//this just example well view-source:https://stackoverflow.com
alert("view-source:" +window.location.href);
//result view-source:https://stackoverflow.com

/*then my problem is window.open() function like this*/
window.open("view-source:" +window.location.href, '_blank');
//The coding is right but not call VIEW SOURCE:

if(window.open("view-source:" +window.location.href, '_blank') || "view-source:" +window.location.href){
document.write('<html>hurricane war LOL</html>');

}
<script>

0 个答案:

没有答案