atljarman
asked on
Authenticate browser then open page
I have a coldfusion page that needs to have a user authenticated on another application. Right now the user has to click the link on my page once then the link does not fully function as the user is first logged on. What I would like to have javascript open the page, verify no 404 or other server error, then reopen the same page. Is this possible?
Hmmm...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Maybe just waiting til page opens, close it, then reopen the same page?
I don't understand your process but it doesn't sound like javascript will do what you want. You might as well try it though. At least then you'll know.
As per previous, im not quite sure what your asking for, but her it goes.
I'm pretty sure it can be done asynchronously using a jquery ajax call
http://api.jquery.com/jquery.ajax/
Scroll down to where is says "statusCode"
For example:
I'm not suggesting this a best practice approach or wether or not it will work, but this is a good place to start looking and by all accounts it should be close to a solution.
It also suggests that the same thing could be done with vanilla JavaScript.
Regards
I'm pretty sure it can be done asynchronously using a jquery ajax call
http://api.jquery.com/jquery.ajax/
Scroll down to where is says "statusCode"
For example:
$(document).ready(function() {
$.ajax({
type:'GET',
url: window.location.href, // OR the page you want to check for 404, 500 etc.
statusCode: {
500:function() {
alert('HTTP 500 Error has occurred.');
},
404:function() {
alert('HTTP 404 Error has occurred.');
},
200:function() {
// Everything was ok
location.reload(); // or redirect to another page
}
}
});
});
I'm not suggesting this a best practice approach or wether or not it will work, but this is a good place to start looking and by all accounts it should be close to a solution.
It also suggests that the same thing could be done with vanilla JavaScript.
Regards
ASKER
Thanks. I was thinking Along these lines and will try your suggestion Monday or Monday night.