Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message only on IE 11 on Windows 2012 R2 - Solved #46

Closed
R5ty5tt opened this issue May 22, 2017 · 12 comments
Closed

Error message only on IE 11 on Windows 2012 R2 - Solved #46

R5ty5tt opened this issue May 22, 2017 · 12 comments
Assignees
Labels

Comments

@R5ty5tt
Copy link

R5ty5tt commented May 22, 2017

I was able to make this plugin work perfectly on multiple browsers, including Chrome, Edge, and IE11 on Windows 10. However, somehow, when I open the page including this plugin on
Explorer 11 (Version: 11.0.9600.18666; Update Version: 11.0.42) on Windows 2012 R2, it shows the following error message
"Please disable "Private Mode", or upgrade to a modern browser. Or perhaps a dependency file missing. Please see: http://github.com/marcuswestin/store.js."

I have certainly uploaded all necessary dependency files, including the following:

<script src="../Plugins/jqueryUI/jquery-1.12.4.js"></script> <script src="../Plugins/jqueryUI/jquery-ui.min.js"></script> <script src="../Plugins/JillElaineidleTimeout/store.min.js"></script> <script src="../Plugins/JillElaineidleTimeout/jquery-idleTimeout.js"></script>

Again, this works perfectly on other browsers on Winows 10.
But for some reason, this IE11 on Windows 2012 R2 is showing that message, and the plugin doesn't work. I really need to make this work on the Win2012 R2 server.

Would anyone please provide comments on this issue?
Thanks so much for your time!

@JillElaine
Copy link
Owner

Please "View Source" of the page in the non-working browser, and make sure the store.js is correctly loaded. That error message is generated only if 'store.js' is not enabled or not available. Also check that IE11 is not set for InPrivate Browsing.

@R5ty5tt
Copy link
Author

R5ty5tt commented May 23, 2017

Thanks so much for your comment, JillElaine!
I have made sure that IE11 is not in InPrivate Browsing mode.
I have also loaded "store.min.js" file - if this had not been loaded properly, I would guess other web browsers would have failed.

<script src="../Plugins/JillElaineidleTimeout/store.min.js"></script>

Other than the Store.min.js, is there anything else I would need to in order to properly load store.js ?

Thanks!

@JillElaine
Copy link
Owner

Please use a Javascript console debugger such as the one in Firefox's 'Developer'. https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Opening_the_Web_Console

View the information to check the correct loading of all required scripts, and watch for error messages.

Please read the Installation > script tag on marcuswestin's store plugin. https://github.com/marcuswestin/store.js#user-content-installation

You might try using the marcuswestin script store.legacy.min.js instead of store.min.js?

@JillElaine
Copy link
Owner

Any news, R5ty5tt?

@R5ty5tt
Copy link
Author

R5ty5tt commented May 25, 2017

Thanks JillElaine!

I don't seem to find any clues from FireFox's debugger.
I have tested store.legacy.min.js but it didn't work. I also tested store.modern.min.js and store.everything.min.js; but they didn't work, either.

What seems to be most successful has been "store.min.js" file. I have downloaded the latest version of store.min.js file into a local folder, and it is loaded using the following line of script.

<script src="../Plugins/store.min.js" type="text/javascript"></script>

I believe this is how this should be "installed." Is there anything I am missing here? Are there any other script files that should also be placed in the same folder?

Based on the above, the timeout plugin works perfectly on Chrome, FireFox, Edge, and IE on Windows 10.
The IE11 on Windows 2012 R2 is giving me the error. See the image below - the left is from Chrome, and the right is from IE11 on Win 2012 R2.

capture

@JillElaine
Copy link
Owner

I appreciate that you are working hard to test the script in a variety of browsers & OSs. I have not had anyone report this problem before, but I suspect it is an issue with Windows 2012 R2 + IE11.

If you are unsure how to load an external Javascript, please read the information here: https://www.w3schools.com/js/js_whereto.asp There are many ways to determine if a Javascript file is loaded. All the dependencies for the idleTimeout script are listed in the README.md. There are no other dependencies for the idleTimeout script.

I wonder what will happen if you disable the error message in the idleTimeout script? Perhaps it is a bogus error? The script stops if the error is thrown, so you will need to disable the error.

To disable the error message, you will need to edit the code. This is easy to do. Please download the "un-minified" idleTimeout script: https://github.com/JillElaine/jquery-idleTimeout/blob/master/jquery-idleTimeout.js

Open the downloaded script in a code editor. Don't use Windows Notepad, as it adds extraneous characters to files. There is a Notepad++ editor that will work though. http://www.wpbeginner.com/showcase/12-best-code-editors-for-mac-and-windows-for-editing-wordpress-files/

In your code editor, at the bottom of the idleTimeout script, replace the "construct" function.

ORIGINAL CODE

    return this.each(function () {

      if (store.enabled) {

        store.set('idleTimerLastActivity', $.now());
        store.set('idleTimerLoggedOut', false);

        activityDetector();

        if (currentConfig.sessionKeepAliveTimer) {
          startKeepSessionAlive();
        }

        startIdleTimer();

      } else {
        alert(currentConfig.errorAlertMessageedit);
      }

});

REPLACE WITH

    return this.each(function () {

        store.set('idleTimerLastActivity', $.now());
        store.set('idleTimerLoggedOut', false);

        activityDetector();

        if (currentConfig.sessionKeepAliveTimer) {
          startKeepSessionAlive();
        }

        startIdleTimer();

});

As you can see, the change to the code removes the "test"if (store.enabled). Be careful not to change anything else. A missing comma or parenthesis can break the code.

Save your edited code with a new name - e.g. "jquery-idleTimeout-no-test.js", and then load the modified script into your webpage.

EXAMPLE

<script src="../Plugins/JillElaineidleTimeout/jquery-idleTimeout-no-test.js"></script>

Please test and let me know.

@R5ty5tt
Copy link
Author

R5ty5tt commented May 25, 2017

JillElaine, thanks so much for your continuing help and advice.

I have used your alternative code that disabled the error message. It disabled the pop-up error, but the IE won't still time out properly. So, bypassing that didn't help. But I greatly appreciate your suggestion.

So, I found a block of code that verifies whether an external script has been loaded.

`<script>

//great suggestion @Jasper

var len = $('script[src*="../Plugins/store.min.js"]').length;

if (len === 0) {

    alert('script not loaded');


    loadScript('../Plugins/store.min.js');


    if ($('script[src*="../Plugins/store.min.js"]').length === 0) {

        alert('still not loaded');

    }

    else {

        alert('loaded now');

    }
}
else {

    alert('script loaded');

}

function loadScript(scriptLocationAndName) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = scriptLocationAndName;
head.appendChild(script);
}
</script>`

When I inserted this script into the page in question, the IE showed "Script Loaded." So, at least, based on this code. store.min.js seems to have been uploaded.

I do not completely understand how web browser works, but here are tricky things:
when I use the IE11 on my Windows 10 to run this page using a local testing server in my computer, the time-out plugin works great. But using the same IE11 on my Windows 10, when I access the 2012 R2 server via a VPN connection, the timeout plugin stops working (just like the IE11 on the 2012 R2 server does not work).

I wonder if Windows 2012 R2 is imposing some restrictions on IE11 in terms of using jQuery/javascript.
JillElaine, could you think of anything else that I could try based on the progress so far?

Thanks so much!

@JillElaine
Copy link
Owner

JillElaine commented May 25, 2017

If the idleTimeout script runs correctly on all browsers & OSs except the Windows 2012 R2, then it does seem to point to something unusual with Win2012. Some tests that may help narrow it down:

  • Run the web page directly on the Win2012 server without using VPN (eliminates VPN as part of the problem)

  • Run the web page in a browser other than IE11 on the Win2012 (eliminates the browser as part of the problem)

  • Check for user or group policies on the Win2012 that affect Private Mode

My guess is that there is a setting in the Internet Information Services II server on the Win2012 box that is forcing the site into Private Mode or something similar. I suggest you talk to the Server Admin.

Some related information here: https://msfreaks.wordpress.com/2013/12/29/step-by-step-customizing-rd-web-access-2012-r2/

@R5ty5tt
Copy link
Author

R5ty5tt commented May 25, 2017

Thanks JillElaine!

I have tested the IE11 on the Win2012 server directly without using a VPN, and it doesn't work. So, I don't think VPN is an issue here.

I have tested Chrome on the Win2012, it works perfect. So, the problem is only with the "IE11 on the Win2012."

I will contact the server administrator about the private mode; and keep you updated. Thanks again!

@JillElaine
Copy link
Owner

The idleTimeout script uses 'localStorage' (via the store.js plugin from Marcus Westin) to set & retrieve a few variables. These localStorage variables are available across multiple browser windows and tabs, so the idleTimeout script can keep them in synch. The 'test' in the idleTimeout script just checks if the script can set a localStorage variable. If it can't, then the script prints the error and exits. https://en.wikipedia.org/wiki/Web_storage

@R5ty5tt
Copy link
Author

R5ty5tt commented May 26, 2017

Hi JillElaine,
Finally, a solution was found. I realized that IE11's default setting of "Display intranet sites in Compatibility View" has overridden the tag " "
This tag is supposed to force IE11 to run in the Edge mode, but it seems that it has not been the case in an intranet site when IE11 has this default setting of compatibility view turned on. After I uncheck this option, now the time-out plug-in works like a charm in IE11. Thanks so much for all your help, and I have learned a lot in this process from you. I greatly appreciate your wonderful help along the way!!!

@JillElaine
Copy link
Owner

I am so glad you solved the issue! IE's 'compatibility view' can cause many subtle problems with sites. Thank you for posting the solution.

@JillElaine JillElaine self-assigned this May 31, 2017
@JillElaine JillElaine changed the title Error message only on IE 11 on Windows 2012 R2 Error message only on IE 11 on Windows 2012 R2 - Solved May 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants