top of page

Wix - How do I link an iframe to the main window in HTML?

I have a client who is using a Tripleseat embedded form in an iFrame on Wix, and they wanted us to insert some additional tracking code to track the form submissions. See the code below. The problem was that this embedded iframe code was opening up the thank you redirect page URL inside the iFrame instead of the main mother window. This was fixed by changing the target of the redirect to .top.

We changed: window.location to window.top.location, so the .top addition opens the redirect URL into the mother page/window instead of just inside the iframe.


Original tracking / redirect code:

<script>

TS.custom_success_callback = function(success_message, lead_id) { 

 // view the success message

 // redirect to a custom url

  // lead_id is the id of the created lead

  // it can be used for custom tracking/analytics

  record_new_lead(lead_id);

}

</script>

Fixed code script so that the iframe loads into the mother window/page instead of just inside the iframe:

<script>

TS.custom_success_callback = function(success_message, lead_id) { 

 // view the success message

 // redirect to a custom url

  // lead_id is the id of the created lead

  // it can be used for custom tracking/analytics

  record_new_lead(lead_id);

}

</script>



3 views

Recent Posts

See All

Reach out with questions or for a free design estimate:

As a website designer and graphic designer, I love sharing great tips and tools that make designing easier. As part of my website design services, I train clients on how to update their websites or to do their own SEO (search engine optimization), so I post many of these tips for my clients to train them how to use Wix and other tools to keep their website up-to-date. Keeping websites current is the best way to get found and to keep people coming back to your website. 

Check out all my Design & SEO tips and resources in my blog

bottom of page