Jump to content

Code for redirect after form submission (IN NEW TAB)

Recommended Posts

  • 6 months later...
  • 3 months later...

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.

Link to comment
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? 

Link to comment
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.

Link to comment
  • 8 months later...
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!

Link to comment
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.

Link to comment
  • 9 months later...
  • 1 month later...

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!

Link to comment
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.

Link to comment

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.