Link to home
Start Free TrialLog in
Avatar of kikelpv
kikelpv

asked on

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

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...
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kikelpv
kikelpv

ASKER

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...




Fine that you solved your problem, but why the grading B?
Avatar of kikelpv

ASKER

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.
Thanks.
Please have a look here: http:Q_21132118.html#12067992
Thanks to both of you.

Zvonko