|
|
 |
 |
 |
 |
Javascript / Client Side Development
|
 |
 |
 |
 |
 |
 |
 |
 |
URL capture and redirect
Hi guys, Not a developer, but an admin so please pardon my ignorance. I have an issue that I was hoping to get help with. What I need is for the front page of my site to capture the URL that the user is requesting. Regardless of where they go, they are prompted to login...but I want the initial login page to capture where they have REQUESTED to go and store it somewhere (I assume a cookie). Then...later on in the process they will hit a redirect page which will read that cookie value and send them to the originally requested page. The reason for all of this is that the current redirection we are using works fine, only it uses the "referrer" header and if the user is sent to a "password change" or "incorrect password" screen then the referrer header changes and becomes useless once the user goes to the latter redirect.html page. Any help is GREATLY appreciated.
DGS said the following on 5/16/2007 8:25 PM: > Hi guys, > Not a developer, but an admin so please pardon my ignorance. > I have an issue that I was hoping to get help with. What I need is for the > front page of my site to capture the URL that the user is requesting.
How is the URL being requested? From links, buttons, or otherwise? > Regardless of where they go, they are prompted to login...but I want the > initial login page to capture where they have REQUESTED to go and store it > somewhere (I assume a cookie).
Then why not require the login *before* a page is requested? Make the main page a login page. They login, they get a page of links. Then have each page check to see if they logged in. If they didn't, then redirect to the login page. The login page will have a hidden field containing the URL that is in the referrer. Then everytime they submit the form it keeps populating that hidden field until they successfully login. Then the server reads that hidden field and redirects to the requested page. No JS needed. -- Randy Chance Favors The Prepared Mind comp.lang.javascript FAQ - http://jibbering.com/faq/index.html Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
"Randy Webb" <HikksNotAtH @aol.com> wrote in message news:g_2dnXn3pdqeO9bb4p2dnA@giganews.com... > DGS said the following on 5/16/2007 8:25 PM: >> Hi guys, >> Not a developer, but an admin so please pardon my ignorance. >> I have an issue that I was hoping to get help with. What I need is for >> the front page of my site to capture the URL that the user is requesting. > How is the URL being requested? From links, buttons, or otherwise?
The URL is most frequently accessed from various customer's intranet pages...using links. However there are a variety of customers and methods in which the URLS are requested. >> Regardless of where they go, they are prompted to login...but I want the >> initial login page to capture where they have REQUESTED to go and store >> it somewhere (I assume a cookie). > Then why not require the login *before* a page is requested? Make the main > page a login page. They login, they get a page of links. Then have each > page check to see if they logged in. If they didn't, then redirect to the > login page. The login page will have a hidden field containing the URL > that is in the referrer. Then everytime they submit the form it keeps > populating that hidden field until they successfully login. Then the > server reads that hidden field and redirects to the requested page. No JS > needed.
The product in use here is Tivoli's WebSEAL...which is a reverse proxy webserver with security. Because of the wide variety of URLs the customer is using creating a landing page with links would be impossible...there are simply too many of them. Basically, WebSEAL looks at the URL requested and if authentication is required, stores it away (encrypted in a session cookie where I have no ability to cull out the data). If the user's authentication is succesful they go to a "redirect.html" page local on the WebSEAL server (I could go into why but that is a long story in and of itself...due to SSO reasons). Everything works fine, but the "redirect.html" page uses the referrer header which, if the user was forced to change their password due to expiration, is no longer populated with the originally requested URL.
DGS said the following on 5/16/2007 9:10 PM: > "Randy Webb" <HikksNotAtH @aol.com> wrote in message > news:g_2dnXn3pdqeO9bb4p2dnA@giganews.com... >> DGS said the following on 5/16/2007 8:25 PM: >>> Hi guys, >>> Not a developer, but an admin so please pardon my ignorance. >>> I have an issue that I was hoping to get help with. What I need is for >>> the front page of my site to capture the URL that the user is requesting. >> How is the URL being requested? From links, buttons, or otherwise? > The URL is most frequently accessed from various customer's intranet > pages...using links. However there are a variety of customers and methods > in which the URLS are requested.
Add an onclick to all the links: onclick="saveCookie(this.href)" And then save the href in a cookie. -- Randy Chance Favors The Prepared Mind comp.lang.javascript FAQ - http://jibbering.com/faq/index.html Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Randy Webb wrote on 17 mei 2007 in comp.lang.javascript:
> DGS said the following on 5/16/2007 9:10 PM: >> "Randy Webb" <HikksNotAtH @aol.com> wrote in message >> news:g_2dnXn3pdqeO9bb4p2dnA@giganews.com... >>> DGS said the following on 5/16/2007 8:25 PM: >>>> Hi guys, >>>> Not a developer, but an admin so please pardon my ignorance. >>>> I have an issue that I was hoping to get help with. What I need is >>>> for the front page of my site to capture the URL that the user is >>>> requesting. >>> How is the URL being requested? From links, buttons, or otherwise? >> The URL is most frequently accessed from various customer's intranet >> pages...using links. However there are a variety of customers and >> methods in which the URLS are requested. > Add an onclick to all the links: > onclick="saveCookie(this.href)" > And then save the href in a cookie.
Good idea, Randy, but it would fail, if the user has multiple sessions in different windows of the same browser type, as cookies do not natively know about sessions. I think we should advice the OP to use serverside sessions and scripting, also while his stipulation of a login already hopefully implies having serverside technology available. asp jscript: <script language='jscript' runat='server'> if (session('loggedin') != 'yes') { session('urlToReturnToAfterLogin') = request.Servervariables('URL'); response.Redirect('login.asp'); }
</script> Using an include for this makes life even easier. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
|
 |
 |
 |
 |
|