简体   繁体   English

如何在新创建的_blank选项卡上调用函数

[英]how to call function on new created _blank tab

How can I copy page to new tab, and call .ready(function(){}); 如何将页面复制到新标签页,并调用.ready(function(){}); on new created tab? 在新创建的标签上?

$("#copyTab").live("click", function () {
     var url = window.location.pathname;
     window.open(url, '_blank');
});

You will need to add scripting to the new page. 您将需要向新页面添加脚本。 So you will have to be in control of the page that you are opening. 因此,您将必须控制要打开的页面。

Add this to the new page before the </body> tag: 将此标签添加到</body>标记之前的新页面中:

<script type="text/javascript">
    $(document).ready(function () {
        // code here
    });
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单击 [target="_blank"] 后如何在新选项卡上定位选择器 - 无法激活创建的新选项卡 - How to target the selector on new tab after clicking a[target="_blank"] - Failing to activate the new tab created 在对象中创建新对象时如何自动调用函数 - How to automatically call a function when a new object is created within an object 在新标签页中加载页面后调用函数 - Call function after page was loaded in new tab 如何在新标签页中打开新建的图片? - How to open the newly created image in a new tab? 如果有 target=_blank,如何在新选项卡中打开链接? - How can I open a link in a new tab if it has target=_blank? 如何使用 id 和目标 _blank 在新标签页中打开页面 - How to open a page in a new tab using an id and target _blank 如何在浏览器的新标签页(_blank)中设置打开pdf文件的标题 - How to set title for pdf file opening in new tab (_blank) in browser 如何通过单击 puppeteer 打开和控制新标签 TARGET _BLANK - How to open and control a new tab TARGET _BLANK by click puppeteer 打开新标签时如何避免空白被阻止 - how to avoid about blank blocked while open a new tab 如何在新选项卡中打开URL,该URL也会同时更改源位置并在新选项卡中打开。 失败“ target_blank” - How to Open a url in new tab that changes the source location also and opens in new tab | Fail “target_blank”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM