Open a new tab/window and write something to it?

后端 未结 3 1587
清歌不尽
清歌不尽 2020-11-27 20:59

I\'m using Execute JS to write and test Javascript code within Firefox. I want to open a new tab/window and write something to it and I tried

var wm = Compon         


        
3条回答
  •  囚心锁ツ
    2020-11-27 21:24

    Edit: As of 2018, this solution no longer works. So you are back to opening about:blank in a new window and adding content to it.

    Don't "write" to the window, just open it with the contents you need:

    var data = "

    This is 'myWindow'

    "; myWindow = window.open("data:text/html," + encodeURIComponent(data), "_blank", "width=200,height=100"); myWindow.focus();

    For reference: data URIs

提交回复
热议问题