Hi there,
We want to embed an external form on a wix landing page. The form is in an iframe.
On Instapage we used send a link to our users, that included parameters in the url. These parameters where then used to render an customized iframe. This is our process on instapage.
We add a js script in the footer of the page (to make sure the script loads before the iframe), this buid the target:
const iframe = document.getElementById("sellerIframe"); iframe.src = "https: // app.xxx . com/login/?" + window.location.search.substr(1)"
We then use the code with the ID to display the personalized form
<iframe id="sellerIframe" title="Seller Form" width=100% height="740"> </iframe>
We send a URL like this to our users:
"www. landingpage. com/?to=123456789"
where 123456789 is a unique identifier for that user.
We tried to add the same structure in wix, couldnât manage to load the script on the page, thus iframe stays blank.
Anyone have a workaround or a simple solution to do this ?
Note: Iâm not a developer
Note: I had to put some spaces in the urls to post this thread
J.D
August 11, 2022, 10:24am
3
Hi. it depends.
If you donât need to set the
//landing page:
import wixLocation from 'wix-location';
$w.onReady(() => {
const id = wixLocation.query?.to;
$w('#myHtmlWidget').src = "https://app.xxx.com/login/?" + paramKey + '=' + id;
})
But If you do need to set the iframe attributes youâre better create an iframe using Custom Element.
Thanks J.D for your help,
I tried to inject the code directly in the widget code but this doesnât seem to even retrieve an iframe (I modified the url of course)
J.D
August 11, 2022, 1:30pm
5
Donât put it in the widget.
Put it in the webpage code panel (turn on the editor dev mode, if you havenât done it already)
Thanks J. D.
Finally managed to implement it using part of the code you referred to and also naming the iframe in the right panel
Method for me:
Create a widget on the page
Open Dev Tool
Select the widget
On the right panel of dev tool replace it by the chosen name (eg. myForm)
Add the below code on the page
//landing page:
import wixLocation from âwix-locationâ ;
$w . onReady (() => {
const id = wixLocation . query ?. to ;
$w ( â#myForm â ). src = âhttps://www.myform.com?to= â + id ;
})
Hope that helps someone else looking to do the same:
1 Like