Web View Scripting

Omniscope Web View Scripting

Scripting inside the Omniscope Web View browser window

The Omniscope Web Views are browsers that allow browser-friendly scripts in the page content, executed in the system default native browser and embedded within Omniscope, to access certain Omniscope variables, through a global JavaScript object named 'omniscope'. Currently, the current file URL can be retrieved through this mechanism.

This object is only made available after the page has loaded.  You should not access it on page load or earlier, and should use a timeout to ensure the value has been set.

Provide 'omniscope' global object to page scripts

The global object is currently as follows:

omniscope = {
  "currentFileURL" : "http://....."
}

 

omniscope.currentFileURL : represents the current Omniscope IOK file URL

 

Example
<html>
  <head>
    <script>
      function getGlobalObject(){
         document.getElementById("testId").innerHTML = "URL is " + omniscope.currentFileURL;
      };
      setTimeout ( "getGlobalObject()", 2000 );
    </script>
  </head>
  <body>
    <center>
      <h1>omniscope global object</h1>
    </center>
    <div id="testId"/>
  </body>
</html>