Do you need to load web pages, extract metadata, or generate pictures from the contents of pages on a headless server? If you answered “yes”, then you’re in luck because 4D v18 R3 makes it possible! Now you can create an offscreen web area with the WA Run offscreen area command.
The WA Run offscreen area command creates a web area in memory. You need to pass all the useful information for the web area in parameter, such as:
- The URL to load
- The area name
- The callback method called when an event is thrown by the web area
For example, if you want to get the title of the last 4D blog post, you need to load the “https://blog.4d.com” URL:
// url of the html file with the js function to use
// Add a callback method called on event
// create offscreen web area according to $params
$title:=WA Run offscreen area($params)
And use this code in the callback method, GetBlogTitle:
If (FORM Event.code=On End URL Loading)
You can refer to the documentation to see in detail what you can do with these new commands.