Solved

Authenticate browser then open page

Posted on 2014-11-12
8
90 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 8

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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JQuery Autocomplete Tag AJAX (Need nice script) 11 35
html border input line 7 16
asp.net open new page without popup blocker 8 19
2 separate CSS animations 2 17
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article discusses how to create an extensible mechanism for linked drop downs.
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 style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

828 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