Solved

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

Posted on 2004-09-14
8
1,205 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
Comment Utility
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
Comment Utility
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
Comment Utility
Fine that you solved your problem, but why the grading B?
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:kikelpv
Comment Utility
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
Comment Utility
Thanks.
0
 
LVL 63

Expert Comment

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

Expert Comment

by:Zvonko
Comment Utility
Thanks to both of you.

Zvonko
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now