Solved

Authenticate browser then open page

Posted on 2014-11-12
8
84 Views
Last Modified: 2015-01-02
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?
0
Comment
Question by:atljarman
8 Comments
 
LVL 6

Expert Comment

by:Mukesh Yadav
ID: 40437128
Hmmm...
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40437140
I don't think that will work.  A quick search doesn't find any way for javascript to read the HTTP status codes.  A 404 page is just another page to javascript.
0
 

Author Comment

by:atljarman
ID: 40437160
Maybe just waiting til page opens, close it, then reopen the same page?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40437174
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.
0
 
LVL 1

Expert Comment

by:bjmurray
ID: 40470989
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:
$(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
			}
		}
	});
});

Open in new window


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
0
 

Author Comment

by:atljarman
ID: 40471156
Thanks.  I was thinking Along these lines and will try your suggestion Monday or Monday night.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Close "X" button on window popup in Firefox 7 37
Polygon I google maps 1 16
FIELDSETs and LEGENDs in email markup 1 13
Message not shown 5 33
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now