简体   繁体   English

wordpress contact 7 URL Redirect with target=_blank

[英]wordpress contact 7 URL Redirect with target=_blank

i wan to redirect my form after submit it i found the code which will do that on_sent_ok: "location.replace('http://www.YOURSITE.com');"我想在提交后重定向我的表单,我找到了可以在 on_sent_ok 执行此操作的代码:“location.replace('http://www.YOURSITE.com');” but here is the twist i want redirect url with target blank .it means when visitor submit a form it will open a new page with target="_blank" link in contact 7 form of wordpress please help me in it但这是我想要重定向 url 目标为空白的扭曲。这意味着当访问者提交表单时,它将打开一个带有 target="_blank" 链接的新页面 联系 7 形式的 wordpress 请帮助我

Thanks谢谢

You have to use client-side code, like javascript.您必须使用客户端代码,例如 javascript。

hope this code helps希望这段代码有帮助

<?php
if(condition==true) {
?>
    <script>
       window.open("http://www.example.com");
    </script>
<?php } ?>

I can't add comments.我无法添加评论。 but just to clear this: if You use Contact Form 7 plugin you just need to paste the following in Additional settings tab of your form:但只是为了清除这一点:如果您使用 Contact Form 7 插件,则只需将以下内容粘贴到表单的其他设置选项卡中:

on_sent_ok: "window.open('http://example.com/');"

http://example.com/ is your URL off course. http://example.com/是您的网址。

But note, that you may have problems with browser popup settings, because new tab is opening without user action/permission.但请注意,您可能会遇到浏览器弹出设置的问题,因为新选项卡在没有用户操作/许可的情况下打开。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM