How to Redirect into the top frame?

Results 1 to 3 of 3

Thread: How to Redirect into the top frame?

  1. #1
    Jeff Ishaq Guest

    Default How to Redirect into the top frame?

    Hey folks. In an ASP page nested inside of a few frames, how can I use Response.Redirect("somepage.asp"), but make the browser display somepage.asp as the top-most frame?<BR><BR>I&#039m new to JavaScript, but I tried sticking this at the head of somepage.asp:<BR>&#060;SCRIPT LANGUAGE="JavaScript"&#062; <BR>if ( top != self ) top.location = self.location;<BR>&#060;/SCRIPT&#062;<BR><BR>It achieved the desired effect, but as I feared, I had problems moving Back in the browser to the previous page -- it just kept reloading somepage.asp.<BR><BR>I had some old code that worked, but it was a different system. It was a SUBMIT action:<BR>&#060;FORM action="somepage.asp" target="_top"&#062;<BR><BR>Hmm, maybe I can just make an invisible form just like that, and document.myform.submit() it, instead of doing the redirect. A little hackish though.<BR><BR>This one has me stumped. Thanks!<BR>-Jeff

  2. #2
    Join Date
    Dec 1969

    Default RE: How to Redirect into the top frame?

    There is an article on this issue at However, I couldn&#039t make it work because I don&#039t understand the TargetName and Location in the following code they recommend:<BR><BR> url = ""<BR> response.write("&#060;script&#062;" & vbCrLf)<BR> response.write("targetframename.location.replace(& #039" & url & "&#039);" & vbCrLf)<BR> response.write("&#060;/script&#062;")<BR><BR>If my page is default.asp and target "_top", how would I write the 3rd line above? And, can this script go anywhere in my HTML page or does it need to be under &#060;HEAD&#062;&#060;/HEAD&#062;. Any help would be great.

  3. #3
    Jeff Ishaq Guest

    Default RE: How to Redirect into the top frame?

    I think you would just say<BR>response.write("_top.location.replace(&#039 default.asp&#039))<BR><BR>I think _top is the default name for a top frame. If you want to point it to a named frame in a frameset, you&#039d just put whatever the name of the frame is in the line:<BR><BR>response.write(" place(&#039default.asp&#039))...<BR><BR>My solution was to use a hidden form, since I KNOW that it works, and auto-submit it in JavaScript:<BR><BR>&#060;FORM NAME="hiddenForm" ACTION="default.asp" METHOD="POST" TARGET="_top"&#062;<BR><BR>&#060;SCRIPT LANGUAGE="JavaScript"&#062; <BR>document.hiddenForm.submit();<BR>&#060;/SCRIPT&#062;<BR><BR>Good luck!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts