Can anyone share an example of how to display an html file from the local workstation in the DeltaV Live web browser object?
BOL states this can be done but does not give a location to store the html file or criteria for a local web server. It works fine for external web content but that is not feasible in a secure system. Using "file://..." or Node.js to add "localhost:8080" is not working on my system even with adding it to $UrlWhiteList. The ultimate objective is to have an equivalent of a VBA ListBox in Live.
Thanks.
In reply to Matt Stoner:
Matt,
Below is an example of the type of Operate VBA ListBox I would like to replicate in Live. In Operate VBA the data is an array that can be displayed in the Listbox so the user can scroll and take actions like click on an entry. This is not specific to alarm data but used for other types of data. The same thing could be done in a web page using HTML5 code but my question is how to display web document this inside a Live web browser. The web browser is also handy for document display inside the graphics like P&ID and SOP.
BOL mentions the broser can display "URLs on the local machine" and suggests video feed and "local applications" as examples but does not explain how this is done. I can't figure out where to place my html file so the web browser can display it. Does it require setting up a local web server with something like Apache or Node.js and if so are there restrictions on port numbers, etc.? Is there a special 'home' directory to use? Do you need to set up a web server on the local network? I'd like to be sure any local web server does not interfere with Live.
Any examples of dislaying web content from the local machine or suggestions for replicating a ListBox would be a great help.
Thanks,
In reply to RobPerry:
Andre Dicaire
In reply to Andre Dicaire:
In reply to Lun.Raznik:
This is what I have done to get something going. I am using a stand-alone Simulate v14.3.1 Build 11067.
<!DOCTYPE html><html> <head> <title>Hello World</title> <body> <p>Hello World!</p> </head></html>
That seems to work so I am going to explore out from there and see what kind of html functions and scripting the embedded browser supports, also how to get data from Live into the browser.
Hope this helps.
To wrap this up I promised to post if a method could be found to send data (value, text, array) from DeltaV Live to the web browser. It can be done using HTML5 cross-domain messaging after converting to JSON format.
In the browser an html file script uses addEventListener to set up an event to receive data from the DeltaV Live domain (http://localhost:5000). In Live the trick is to find the id of the web browser (an HTML5 iframe object) to send the data. The key parts of the code are listed below. The browser can then be used for tables, display, processing, data exchange with sessionStorage, etc. The process also works in reverse so appropriate security must be included in any code.
Web Browser script (start)
DeltaV Live script (partial)
Many thanks Rob, you've managed to accomplish what hundreds of StackOverflow threads couldn't. You mentioned that the process works in reverse, though I'm struggling on how to make this true. Do you have any code snippets where the web browser script writes to DeltaV Live and Live has an active listener function?
In reply to Andrew Daly:
Glad you found the code useful despite me mixing up the labels of the code.
The test I did to go from browser to DeltaV Live is shown in the graphic below that I hope is readable. A button script in DeltaV Live starts a listener, a button in the webpage writes data to the listener, and the listening script receives and places the data into a DeltaV Live object. It's a bit of a manual process but hope it helps your project.