Thanks for the quick reply!

We had constructed a minimal test: an external js file that contains
*alert('hello')* on a single line and nothing else.

We may have now narrowed the scope of this issue to WA Execute JavaScript's
ability to handle the '\n' in the javascript that it reads from a file.

When the file is read into 15.4 or 16.4 the returned text is
*alert('hello')\n*. This was not a problem in 15.4, but the \n creates a
problem with WA Evaluate JavaScript in v16.4.

Overcoming the bug by processing the read JS (to remove the \n) does the
trick for our very simple test case (JavaScript in external files that are
only a single line). Web areas in v16.4 will now 'alert' as expected.

        $tJS_path:=Get 4D folder(Current resources folder)+"ncs_test.js"
        DOCUMENT TO BLOB($tJS_path;$bDoc)
        $test_js:=BLOB to text($bDoc;UTF8 text without length)
          // replace the carriage return \n with ''
        $codeBody:=Replace string($test_js;Char(10);"")
        WA Evaluate JavaScript(wa;$codeBody)

However, this is obviously not going to solve our larger problem of being
able to load JavaScript libraries to scrape a web page.

The JavaScript code in the external files contains comments... and perhaps
other nuances that would render the above solution insufficient.

On Thu, Dec 20, 2018 at 9:58 AM John DeSoi via 4D_Tech <>

> Try turning 'Use embedded rendering engine' off for the web area. And
> verify your JavaScript code works outside of 4D in Safari when using Mojave.
> John DeSoi, Ph.D.
> > On Dec 20, 2018, at 11:10 AM, Noah via 4D_Tech <>
> wrote:
> >
> > The parent form:
> > Case of
> >    : (Form event=On Load)
> >        WA OPEN URL(wa;"";)
> >        WA SET PREFERENCE(wa;WA enable JavaScript;True)
> >        WA SET PREFERENCE(wa;WA enable Web inspector;True)
> > End case
> >
> > 'Use embedded rendering engine' is checked.
> >
> > Has anyone else experienced this? Any suggestions?
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:
> Options:
> Unsub:
> **********************************************************************
4D Internet Users Group (4D iNUG)

Reply via email to