Add dynamic iframe

Hello!

I want to embed a videoask to my wix page. But in order to save user id from wix I need to add a variable to the iframe code.

Iframe code example:

<iframe src="https://www.videoask.com/XXXXX#variable1=XXXX&variable2=XXXX" allow="camera *; microphone *; autoplay *; encrypted-media *; fullscreen *; display-capture *;" width="100%" height="600px" style="border: none; border-radius: 24px"></iframe>

How can I pass wix user id to iframe dynamically?

Thanks in advance!

Hi Timur,

You might consider setting your iFrame’s source URL directly using Velo:

$w.onReady(() => {
    let var_1 = 'XXXX';
    let var_2 = 'XXXX';
    let var_3 = 'XXXX';

    $w('#your_iframe').src = `https://www.videoask.com/${var_1}#variable1=${var_2}&variable2=${var_3}`;
});

Additionally, if your iFrame is embedded in a custom HTML element, you can also use Wix iFrame Messages to communicate back and forth with your embedded iFrame: