Running Javascript in new window.open

前端 未结 4 1937
执念已碎
执念已碎 2020-12-01 22:10

I\'m running this function to open a new window.

function htmlNewWindow(id) {
    var html = $(id).html();
    var newWindow = window.open(\'\');
    newWind         


        
4条回答
  •  被撕碎了的回忆
    2020-12-01 22:17

    Just in case someone has this to be done in a link. Do the following:

    Link
    

    This opens a new window with that URL, it set the focus to that windows, and as soon as the 'load' event is triggered, it executes the code in the function. It only works with a page in the same domain.

    Hope this helps ⬆✌.

    Cheers

提交回复
热议问题