简体   繁体   English

一键重定向和打开新标签页的方法

[英]How to redirect and open new tab in one click

In page one : Form and submit to page two 在第一页:填写表格并提交至第二页

page two : Insert data, open new tab and redirect to page one 第二页:插入数据,打开新标签并重定向到第一页

I'm using 我正在使用

window.open("pdf_order.php?p=<?=$paper;?>","_blank");
window.location = "page1.php";

but, It's doesn't work because block popup on browser. 但是,它不起作用,因为在浏览器中阻止了弹出窗口。

According to your question, you want to issue a window.open call when you arrive on "page two." 根据您的问题,您想在到达“第二页”时发出window.open调用。

You can't, because that's what scuzzy websites used to do, and this is the whole point of popup blockers. 您不能,因为那是混乱的网站过去要做的事情,而这就是弹出窗口阻止程序的全部目的。 Instead, you'll need to adjust the clickflow so you're not trying to do that. 相反,您需要调整点击流,以免您尝试这样做。

This is a question of the type: Doing X is not allowed. 这是类型的问题: 不允许执行X。 How to do X? 怎么做X?

If a popup blocker allowed you to do a popup, it would be a very bad blocker, and people would not use it. 如果弹出窗口阻止程序允许您执行弹出窗口,那将是一个非常糟糕的阻止程序,并且人们不会使用它。

Please understand that a popup blocker is always a step ahead of you: it uses interface to a concrete Web browser which in turn take a total control of all rendering and scripting on the client side. 请理解,弹出窗口阻止程序始终是您前面的一步:它使用特定Web浏览器的界面,而该Web浏览器又可以完全控制客户端上的所有呈现和脚本。 And your application is supposed to work with all kinds of HTTP client software and be somewhat abstracted from it. 您的应用程序应该可以与各种HTTP客户端软件一起使用,并且可以从中抽象一些。 From this point, it's easy to understand that it's much easier for a blocker to block your code then break this blocking. 从这一点出发,很容易理解,阻塞者阻塞代码然后打破阻塞变得容易得多。

found this answer on http://www.codeproject.com/Questions/474314/PopUpplusBlockerplusisplusdisplayingpluswhenplusop http://www.codeproject.com/Questions/474314/PopUpplusBlockerplusisplusdisplayingpluswhenplusop上找到了此答案

try AJAX 试试AJAX

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

相关问题 如何在jQuery中使用“ctrl + click”而不是重定向当前选项卡打开新选项卡? - How to open new tab with “ctrl+click” instead of redirect current tab, in jQuery? 需要一键打开新选项卡中的链接并关闭当前选项卡 - Need to open link in new tab and close current tab with one click 如何在新标签页中打开新页面并重定向当前页面 - How to open new page in new tab and redirect current page 如何在新选项卡中打开documentFragment - How does one open a documentFragment in a new tab 如何使用 Playwright 打开新选项卡(例如单击按钮在新选项卡中打开新部分) - How to open the new tab using Playwright (ex. click the button to open the new section in a new tab) 如何在ASP C#上打开新标签页,然后将焦点集中在当前页面上,然后单击按钮将当前页面重定向到另一个页面? - How to open new tab on ASP C# and focus stay on current page then current page redirect to another page on click button? 点击选项卡打开一个新网页 - open a new webpage on click of tab 单击超链接打开一个新选项卡 - Open a new tab on click of hyperlink 如何打开新选项卡并重定向到链接 EXT JS portlet 按钮 - how to open new tab and redirect to link EXT JS portlet button 如何在新选项卡中打开链接以及在当前重定向 - How to make a link open in new tab as well as redirect in current
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM