I would suggest constructing an HTML page and loading any javascript libraries 
you need into it. Then load that page into a web area on a form. That will 
allow you to use WA EXECUTE JAVASCRIPT FUNCTION instead to call the functions 
you need from your loaded page. If this has to occur on the server and you 
cannot run a utility client, the NTK plugin 
https://www.pluggers.nl/product/ntk-plugin/ has a javascript interpreter that 
may work for you.


Tom DeMeo

> Message: 4
> Date: Thu, 20 Dec 2018 10:21:00 -0800
> From: Noah <n...@gus.ucsb.edu>
> To: 4D iNug Technical <4d_tech@lists.4d.com>
> Subject: Re: WA Evaluate JavaScript in 16.4
> Message-ID:
>       <cacuosgozkb3kzqtw_kcg7uh_pbdso-6dnj5v5vzo2q9iljs...@mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
> 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.
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com

Reply via email to