Create IFRAME only when arrive on keyframe

SAOLA v. 3.0 Testing.
Win. 8.1

Hi Team! In my educational project, I need an IFRAME element to appear only when the script is called at a certain keyframe on the
timeline. However, when I insert the script I discovered to create the iframe in the Timeline Trigger, I get an error message: “Error parsing document. Check browser console for more information.” I don’t have much knowledge so I know I’m doing something wrong. I need the IFRAME to open ONLY when it reaches this keyframe, not before. The file is attached. Thank you very much !!!

Error_Parsing
Test_call_js_timeline.zip (56.2 KB)

Hi Alexandre,

The script in the timeline trigger has incorrect syntax so you see the error message.
timelineEventHandler is already a JavaScript function, there should be no script tag inside it.

In your case, you don’t need any script at all.
Just set the web page URL for the HTML Widget, hide the widget at the beginning and show it when the button is clicked or at a specific time in timeline.
show-iframe-at-time-or-on-clicked.saolapack (2.5 KB)

Regards

Hello Toan!!
I totally understand, but instead of opening a url, I wanted to send an email, and the script in this example does that perfectly.
When we place an IFRAME, it loads automatically when running the presentation. So, imagine the script triggers the email without user action. With this script in the example, notice that the email is only sent after clicking the button, and I wanted it to be triggered by the timeline.
Test_call_js_timeline.zip (3.2 KB)

Hi Alexandre,

Do you want to load a PHP page at a specific time to send an email?
If so, you can use the following script for your timeline trigger:

function timelineEventHandler(doc, e) {
	// replace HTML_Widget_1 by your widget name
	var htmlWidget = doc.getElement('HTML_Widget_1');
	if (htmlWidget) {
		// clear embedded src before setting new url
		htmlWidget.setSrcDoc('');
		htmlWidget.setUrl('https://your/php/page/url');
	}
}

Regards

Toan, thank you so much for your idea, and I will use it! But actually I want to use the power of the iframe in several cases, and what I need is that, when placing an iframe at any point of a timeline, and EXECUTE THE IFRAME ONLY WHEN IT REACHES THAT TIMELINE MARKING, regardless of its content, understand ? Thank you so much!

You can use the script above for that purpose, just replace the URL for each timestamp.

Regards

Toan, could you give me an example with the email script I gave you inserted into a timeline? I’m really sorry, but I’m very new to programming, and I want to set it up to show my students. Sorry for my ignorance and insistence…

Hi Alexandre,

Sending an email requires running server-side script, but Saola Animate only supports client-side JavaScript.
What you can do is using JavaScript to submit a request to a server for sending an email from there.
Do you have a web server that can run server-side script like PHP?

Yes Toan, exactly with the link I sent you in .php. In my tests, I can put the url in an iframe and it sends it perfectly. But I wanted to control the sending via a Saola button…

So you can do as in my #4 answer.
Did you try it yet?
If not, please try it and let me know the result.
I’m sorry but I don’t really understand what you want.

I’m sorry Toan, I’ll try to make an example, maybe a diagram and get back to you. Thank you very much!

You can also send your .php URL, I’ll help to send request to it when a button is clicked or at a specific time in timeline.
If you don’t want to make it public, you can send it to our support email at support@atomisystems.com

Regards

Exactly what I need! That when a button is clicked or at a specific time in the timeline it sends the command. It can be this same url: https://interavideo.com/digital_signage/emails/modelo1/envia_email_texto_puro1.php

Please see this sample
load-remote-page-at-time-or-on-clicked.saolapack (2.9 KB)

You can click View > Functions to show functions in Functions pane.
The loadRemotePage function in that pane is similar to the function in my #4 answer.
It’s called when Div_1 button is clicked, and at 5 second in Timeline.

Regards

Toan, Thank you! very, very, very much!!! It was exactly what I needed! Sorry for my difficulty in expressing what I needed. My school will acquire Saola. Strongly recommend! Thanks!!

1 Like