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.

Was this Helpful?

Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Anindya
Anindya
1 year ago

Hi Prashant Sir,

while doing this step the page is automatically going to the thank you page without form submission only. Redirection is hapenning on page load directly

Sri Sudhan
Admin
Reply to  Anindya
1 year ago

Hi, Anindya. Can you please elaborate on whether the redirect is happening on a LeadSquared Landing Page or on your organization’s web page? Please send a detailed mail about this to support@leadsquared.com, and we’ll get back to you ASAP.