简体   繁体   中英

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');" 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

Thanks

You have to use client-side code, like 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:

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

http://example.com/ is your URL off course.

But note, that you may have problems with browser popup settings, because new tab is opening without user action/permission.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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