< View all articles in Forms.

How to redirect the host page after lead submits on embedded form?

LeadSquared Landing Pages can be used to create forms and these forms can be embedded as iFrame in your website. Here is an article describing the process. 

On submission of the form, you may want to redirect the lead to a thank-you page or any other web page. By default the redirected page will open within the iFrame in which form is embedded.  If you want the host page (the web page in which form is embedded) to redirect to the new URL, follow these steps:

Create a new landing page having size same as the form size.  Add a simple HTML block with text “Redirecting…”   (you can put any text you want). In the Page Settings step 4 of building landing page, towards the bottom of the page you will see  “Embed JavaScript” section.

Insert the following script  in “Embed JavaScript” section “Inside Head”:

<pre><script>window.top.location.href = “http://www.yourwebsite.com/desired-url”;></script></pre>

Example: If the redirect URL is www.google.com then the script will be:

<pre><script>window.top.location.href = “http://www.google.com”;></script></pre>

Publish this landing page and get the URL. In your form only landing page which you intend to embed on your web page, add an option to redirect to this URL.

Please note that if your landing page is accessed through “http”, you can only direct to a page through http. The redirect will fail if you try to redirect to a page with “https” URL.