IE11 DOM Storage and Scheduled Task issue. RRS feed

  • Question

  • I am not sure what forum this belongs to, so I would like to apologize if this is the wrong place.

    I have a wsf script running as a scheduled task that is using the Internetexplorer.Application to log into a web-interface and change some settings.
    This was working fine until we updated to Internet Explorer 11.
    The script still works fine but not as a scheduled task with the setting to 'run whether user is logged on or not'.

    I have managed to log the same errors in a IE session with DOM storage disabled.
    I believe the issue occurs when a javascript in the page is using the localStorage.

    The row :


    causes the error:
    SCRIPT5007: Unable to get property 'getItem' of undefined or null reference

    In the console localStorage is null, im not 100% sure the same issue occurs as scheduled task but it fails at the same point in the script, so i suspect the DOM storage is the issue.

    I put a simple page on a webserver to test this theory:

    localStorageTest.html content:

    <!DOCTYPE html>
     <div id="potato">Monkey</div>
      function testStorage(){
        var para = document.createElement("P"); //Test if javascript is running at all
        var t = document.createTextNode("JavaScripts are working!");
                localStorage.setItem('key1', 'Hello World'); //Test localStorage
                 var mydiv = document.getElementById('potato');
                 mydiv.innerText = localStorage.getItem('key1');

    Using the following script to write the html to file:

    Set IE = wscript.CreateObject("Internetexplorer.Application")

    'Set IE = GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}")


    MyLogToFileSub IE.Document.body.innerHTML



     Running normally:

     <DIV id=potato>Hello World</DIV>

     Running scheduled task with setting 'Run only when user is logged on':

      <DIV id=potato>Hello World</DIV>


     Running scheduled task with setting 'Run whether user is logged on or not':

    <DIV id=potato>Monkey</DIV>

    All tests contains the P tag:

    < P>JavaScripts are working!</P>

    Is there anyway to enable DOM Storage for batch jobs for Internet Explorer 11?
    Tested on windows Server 2008 R2 SP1 x64, IE version 11.0.9600.18977 & windows 7 SP1 x64, IE version: 11.0.9600.19035.

    I cannot make changes to the web-interface I have problem with as it is running on third-party hardware.

    Br Mikael.

    • Edited by Mikael_2 Monday, July 9, 2018 2:06 PM clarifying windows versions.
    Friday, July 6, 2018 7:32 AM