Jump to content

Code for redirect after form submission (IN NEW TAB)

Recommended Posts

  • 6 months later...
Posted

I am looking for this answer as well? Anybody any thoughts on this?

In my case, it's opening a post-submit redirect url in a new tab.

  • 3 months later...
Posted

I am in this situation too. Any luck on finding code?

Posted

You can use the Post-Submit Message HTML field and add the following.

<script>

  const url = 'http://www.tomsWeb.consulting/';
  
  open ( url, '', 'target=_self' );
  
  </script>

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Posted
On 10/1/2021 at 4:29 PM, creedon said:

You can use the Post-Submit Message HTML field and add the following.

<script>

  const url = 'http://www.tomsWeb.consulting/';
  
  open ( url, '', 'target=_self' );
  
  </script>

Let us know how it goes.

Thank you! It works but it opens a new window. Is it possible to just open the page in a new tab? 

Posted
54 minutes ago, chloe14 said:

It works but it opens a new window. Is it possible to just open the page in a new tab? 

Here is an alternate way to do it.

<script>

  const url = 'http://www.tomsWeb.consulting/';
  
  location.href = url;
  
  </script>

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

  • 8 months later...
Posted
On 10/5/2021 at 6:26 AM, creedon said:

Here is an alternate way to do it.

<script>

  const url = 'http://www.tomsWeb.consulting/';
  
  location.href = url;
  
  </script>

Let us know how it goes.

Hi there,

Bringing up an old post here but I have tried this code and it still opens in the current tab. Any other idea how I can have a page (or preferably a live PDF file) open in a new tab?

 

Thank you!

Posted (edited)
14 hours ago, AndySands said:

how I can have a page (or preferably a live PDF file) open in a new tab?

 

<script>

  const url = 'http://www.tomsWeb.consulting/';
  
  open ( url, '', 'target=_blank' );
  
  </script>

Let us know how it goes.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

  • 9 months later...
Posted

Thanks to creedon for getting some good options here! I was able to get it to open in a new tab by using a slight variation of his code:

<script>
  
  url = 'https://forum.squarespace.com';
  
  open(url, '_blank');
  
</script>

 

  • 1 month later...
Posted

I can't get any of the code snippets to work anymore, but they did a few months ago?  Not sure what happened. We need the post-form submission to redirect to a file that ideally opens in a new tab/window, but we're not picky.

Does anyone have any updated ideas on how to achieve a redirect-URL post form submission that opens in a new tab OR window?

 

Thank you!

Posted (edited)
On 5/2/2023 at 7:05 AM, wpr452 said:

I can't get any of the code snippets to work anymore, but they did a few months ago?

They no longer work because SS changed how forms work.

Quote

Does anyone have any updated ideas on how to achieve a redirect-URL post form submission that opens in a new tab OR window?

Forms of the past were relatively easy to manipulate the redirect mechanism. The new forms are hard, as far as I can tell, and I know of no code currently that can manipulate the redirect.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.