Solved

Frame trouble!!  top.location=self.location;  without sends a submit to the server

Posted on 2004-09-14
8
1,208 Views
Last Modified: 2008-01-09
I’m searching for something that works like this code:

if (top.location != self.location)
{
      top.location=self.location;
}

But I need that the browser doesn't do a submit to paint the page in the Top Frame.


My problem is:

I have a transactional site with 3 types of errors page.
-One of them is a  "Session Expired"
-Another page is a  "Technical Difficulties" (similar to a runtime error in VB). In this case the session is terminated too. But I need to send the "Technical Difficulties" page for know that was a Runtime Error.
-And Timeout page


My site works with frames, but a need that when happened an error, the error page show in the Top Frame. (The entire browser window)
The problem is when happened any error different to "Session Expired".


For example:

Mi server is a CGI (Edify) and this code   Y=1/0;    cause a Runtime error and I send "Technical Difficulties" page in a child frame.
Then the code in the "Technical Difficulties" page

if (top.location != self.location)
{
      top.location=self.location;
}

Sends a SUBMIT to refresh the top Frame with the Error page (Technical Difficulties) but how the session expired too then the server now sends the "Session Expired" error page, and that is wrong. In this case I need "Technical Difficulties" error page.
I need a code that do the function of the code show above but without send a SUBMIT to the server.

Is there any way to do this?

Thanks...
0
Comment
Question by:kikelpv
  • 5
  • 2
8 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 300 total points
ID: 12059983
Submit is reserved word for Form submission.
I understand that you want to show the content of some hidden frame at the top window, BUT withouth getting that page from server. Is that correct?
If yes, then you have to open a new window and copy there the content of your notification frame.
The empty window is opened like this:
<script>
ew=window.open("", "frameName");
ew.document.write(parent.frames.msgFrame.document.body.innerHTML);
</script>


0
 

Author Comment

by:kikelpv
ID: 12060304
OK, Zvonko

Yes, submit is a reserved word for Form submission.

I explain me wrong. I wanted to say that the code: (in Technical Difficulties page)

if (top.location != self.location)
{
     top.location=self.location;
}


Do that the browser go to the server again for the error page (Technical Difficulties) for paint it in the Top Frame.
But when the browser go to the server the session be expired then the server doesnt return the "Technical Difficulties" page, in its place sends "Session Expired" page.
For this reason the code doesnt work for me.
And I dont need to show the page in another window.

But your code was useful to find the answer.

This is the code that write the error page in the Top Frame without go to the server for the page.

if (top.location != self.location){
      top.document.write(document.body.innerHTML);
}

Thanks...




0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12061617
Fine that you solved your problem, but why the grading B?
0
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.

 

Author Comment

by:kikelpv
ID: 12064652
Sorry Zvonko,  this is the first time that I ask a question and I dont know extactly what was a grade. But I was watching the help and now I know what is.

Dont worry I will ask a moderator to change the grade.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12065640
Thanks.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12069501
Please have a look here: http:Q_21132118.html#12067992
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12077359
Thanks to both of you.

Zvonko
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

861 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