webToCheck = context.get_site().openWeb(‘/Subweb’);
and it seemed as the site did not exist. However, the same site could be opened from the Managed Client Object Model.
I launched Fiddler to check what happens in the background and was surprised to see another web site (let’s call it SubwebWrong) in the request. This web site really did not exist, so the response of the server was reasonable.
But where did that site name came from? I found a former entry in the Watch window of the Developer Tools, that referred to this site:
webToCheck = context.get_site().openWeb(‘/SubwebWrong’);
So it seems that this command was executed automatically by IE, that caused the script to malfunction. Pretty strange behavior, indeed.
During debugging I received an erratic “Access denied. You do not have permission to perform this action or access this resource.” error as well. It happened typically after working for a longer time on the same page. I assume that the reason is that the form digest on the page was timed out.