Solved

Authenticate browser then open page

Posted on 2014-11-12
8
79 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
Comment Utility
Hmmm...
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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
Comment Utility
Maybe just waiting til page opens, close it, then reopen the same page?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks.  I was thinking Along these lines and will try your suggestion Monday or Monday night.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

762 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

7 Experts available now in Live!

Get 1:1 Help Now