slGetHTMLCode working only in test mode, not when ran as html - Forum

Forum Navigation
You need to log in to create posts and topics.

slGetHTMLCode working only in test mode, not when ran as html

What I'm trying to achieve is to get text from .txt file hosted on my website then move its contents to a variable. It succeeds when ran in test mode as in the first picture

https://pp.userapi.com/c846322/v846322961/153b54/nLF-dlI6hEY.jpg

BUT

It doesn't move the contents of a iFrame to a variable when using compiled html file (pic 2)

https://pp.userapi.com/c845418/v845418961/15616d/LhhviHPILIo.jpg

what could be wrong? why is it only working when testing the app?

thanks in advance

Hi @Kapacek,

I don't understand very well how are you using slGetHTMLCode, but that command is not intended for getting the content from an iFrame, as the iFrame content is considered to be outside the App scope.

In VisualNEO Web next version there will be a FileToVar action command just to get the content from any file from its URL to a variable. There will be also a LocalFileToVar action command to get the content from a local file the user has selected previously.

Meanwhile, if you need the HTML content from an iFrame try this:

BeginJS
  $App.myvar=document.getElementById('iFrame1').contentWindow.document.body.innerHTML;
EndJS

Where myvar is the name of your VisualNEO Web variable and iFrame1 the name of the iFrame you want to get the content.

Let me know if you have success.