There are two resources for learning about WebView Scripting:
For online documentation, please refer to the DataHub WebView Scripting Manual.
For examples of WebView scripting implementations, please view the last group of these videos, under the title DataHub WebView Video Blog (Advanced Topics), on the Cogent DataHub website.
Several WebView scripts are installed with the DataHub archive. These are found in the installed content file location, under
Content/Common/Scripts/Cogent. You can view these scripts by
opening the Scripts tab in Design mode.

You can use the Script Explorer to browse the scripts:

Scripts whose names start with ex are example scripts. Those that
start with wv contain helper functions that enable you to easily
leverage advanced capabilities like element animation and slide shows. This interface is
read-only, because none of these scripts should be edited.
You can edit an example (ex) script by first copying it to your
user content file location, and modifying
the copy. This way it will not be replaced by the default script when the DataHub program
is updated. However, you should not edit any of the wv scripts like
this, as that may lead to unexpected results.
The exStartSlideShow.ss script starts a slide show that rotates
through selected WebView pages in kiosk view every few seconds.
/*
* This file contains example script that uses the
* Application_UserChanged application event to run a
* slide show when the <slideshow> user logs in.
*
* If you want to customize this function, make a copy
* of this file and add your code to the copy. Do not
* edit the original, as your changes will be destroyed
* when you update the application.
*/
/*
function Application_UserChanged(userName)
{
// In V10, userName includes the organization
// name, e.g., "Local/slideshow"
if (userName == "slideshow")
{
WV.ExecuteCommand("EnterRunMode", true);
WV.ExecuteCommand("ToggleKioskView", true);
WV.ExecuteCommand("ToggleScriptDebugWindow", false);
var pages = new List<|string|>();
pages.Add("Common/Cogent/Circular Gauges");
pages.Add("Common/Cogent/Trend Charts");
pages.Add("Common/Cogent/Water Treatment");
wvSlideShow.EmitDebugMessages = false;
// Start the slide show, advancing every 15 seconds.
wvSlideShow.Start(pages, 15);
}
}
*/
You can make a copy of this script to your user content file location, uncomment the function code, and edit the user name, pages, and number of seconds as needed. Here are some additional tips:
It’s a good idea to create a DataHub
user in DataHub
Security that is specific to your purpose, i.e., don’t use your
slideshowadmin user.
The userName parameter is case-sensitive. If you want a
name with upper-case characters, like
, you can change
this line of the code: SlideShow
if (username == "slideshow")
To this:
if (username.ToLower() == "slideshow")
You can create a group named WebViewSlideShow or
similar and configure it to restrict users to Web -
ViewOtherOwnerPage, Web - ViewPage, and
WebView - Connect, .

Then give the user the
slideshowWebViewSlideShow group permissions.
You can modify the script to access any of your own web pages that are listed
in the WebView My Pages drop-down list by editing a
pages.Add() line in the code, like this:
pages.Add("Users/username/Pages/pagename");That path can be modified for other page locations, if necessary.
The slide show functionality implemented by the wvSlideShow
object in the script is defined in
Scripts/Cogent/wvSlideShow.ss. You can review that file
to understand more about this script.