Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 10th, 2006, 07:35 PM
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with redirect/replace

I am trying to use location.replace and/or location.href to "hide" the initial page (It is started from an application, with parameters as "....htm?x=X1&y=Y1...", and I don't want those parameters to be seen (and in that page I also set a SESSION-variable to use as id, to control the page was started from the application. I have no control over what parameters are sent from the application).
My problem is, that even though the redirect work fine, I am transfered to the other page, the initial URL is still showing in the address-field, and that is really what I try to avoid.
Anyone have an idea what to do? I'd really appreciate it

 
Old March 11th, 2006, 12:57 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii gorros!!
1>Change form method="get" to "post"
2>If you dont' want to show initial page ,redirect the page safely when page is loaded successfully
e.g.

i am accessing a page from page1.asp on form submission
"myfile.asp"?x=X1&y=Y1" <this is the result of method="get">
myfile.asp <when method is "post" field values will not appended in query string ,rather than passed it as http-header-body>

In case of you have no choice to change method=get to method="post"

1>first create a form with required values as hidden with method as post
2>on page load ,submit the form with your newpage.asp whtever.

Note:-if you are accessing the page while clicking on the link.
use javascriipt function ,with form method=post and submit the form.

Hope this will help you


Cheers :)

vinod
 
Old March 11th, 2006, 05:08 AM
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, the problem is that the initial page is initiated from an application, and I have no control over that application. the parameteres are passed as I wrote (...?x1=x&x2=y...), and they will show up in the address-field.
What I would like is to, in the first page, pass these input parameters (that I can access through GET) into SESSION-parameters and then imediatly make a redirect into another page.
The redirect work fine, but in the address-field it still show the path and address to the initial page, not to the page I redirect to. I have tried location.href, location.replace and I don't know what. Every time, I am transfered to the new page, but the initial address is still displayed

 
Old March 11th, 2006, 05:24 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii gorros!!
No probs, let together we try to solve it!!

say you are accessing
http://localhost//myfolder/mypage.asp?x=X&y=Y"


now in mypage.asp write following code

<body onload="submitRedirect()">
<form name="tempform" method="post" action="newpage.asp">
<input type=hidden name=x value="<%=request("x")%>">
<input type=hidden name=y value="<%=request("y")%>">
</form>
<script>
function submitRedirect()
{
document.tempform.submit();
}
</script>

Hope this will help you
I am online on [email protected]





Cheers :)

vinod
 
Old March 11th, 2006, 07:37 AM
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi vinod, did you get my mail? And by the way, thank's a lot for helping






Similar Threads
Thread Thread Starter Forum Replies Last Post
UPDATETEXT Problem: replace one value with another kwilliams SQL Server 2000 0 November 5th, 2007 12:04 PM
problem with redirect.. joeore PHP Databases 2 February 17th, 2004 02:54 PM
Replace problem neo_jakey Classic ASP Basics 2 January 8th, 2004 10:00 AM
repsponse.redirect problem skipinator ASP.NET 1.0 and 1.1 Basics 3 June 8th, 2003 02:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.