I have a problem where a page that is opened as a result of a redirect call does not execute the javascript function. This page is simply a message to indicate that an OAuth2 user session has started so I want it to close right away. It is opened by the redirect initiated by the OAuth server after processing the access_token request.
If I access this page in testing it works fine:
System.Diagnostics.Process.Start("https://localhost:44302/Home/SessionOpen");
The page loads, closes in 2 seconds.
If it is opened via the redirect it never closes...
The dead simple page:
<body onload="closeit();">
<div style="margin-left:auto;margin-right:auto;">
<h3>Session has started.</h3>
<h4>If this window does not close automatically you may close it manually.</h4>
<script type='text/javascript'>
function closeit(){
setTimeout(function() {
window.close();
}, 2000);
};
</script>
</div>
</body>