本文介绍了使用自定义HTML而不是URL打开新选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个Greasemonkey脚本,并且想要打开一个新选项卡,该选项卡不会显示URL,但会显示一些HTML作为脚本的一部分。所以基本上我想做这样的事情(这显然不起作用):
I'm making a Greasemonkey script and would like to open a new tab which will not display a URL but some HTML that is part of the script. So basically I want to do something like this (which is obviously not working):
window.open('<html><head></head><body></body></html>');
or
GM_openInTab('<html><head></head><body></body></html>');
欢迎任何提示!
推荐答案
你可以这样做:
var newWindow = window.open();
然后执行
newWindow.document.write(ohai) ;
这篇关于使用自定义HTML而不是URL打开新选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!