Solved

Help with refresh/reload of frameset ?

Posted on 1998-10-08
33
622 Views
Last Modified: 2006-11-17
Hi,
My application resides in a frameset(3 frames).
Can I in any way make the event from the refresh/reload button in the browser target only one of my frames with the reload ?
Any way to do this ?

I can't have all 3 pages reloaded at the same time !

Please answer fast !

//Jedi
0
Comment
Question by:Jedi
  • 11
  • 5
  • 5
  • +7
33 Comments
 
LVL 3

Expert Comment

by:MorFF
ID: 1838507
Unfortunately it's a 'feature' of the browser, it has full control.  I've got the same problem on my pages.  You could add your own 'refresh button' in one of your frames and then force a 'targeted' refresh from that, but the user could still hit the browser refresh button.

I know this is probably not what you want to hear but it cant be done.

Cheers - MorFF
0
 
LVL 28

Expert Comment

by:sybe
ID: 1838508
With some javascript it must be possible. But you have to know exactly what you want. I don't think there is a general solution.
And it might not work always. If you have an url to point to, I can have a look and do some proposal.


0
 
LVL 8

Expert Comment

by:jbirk
ID: 1838509
Try opening your web page into a new window without the browser buttons along the top.  If you do this, most people won't know how to refresh the entire page.  Most people will use a right mouse click which only reloads the frame which the mouse is over when clicked.
It's not perfect, but an idea.
-Josh
0
 
LVL 1

Author Comment

by:Jedi
ID: 1838510
I belive this is hard to accomplish after reading your answers.
I still want the question to stay on for a while, so therefore I reject your answer. If I don't get an answer that solves my problem within a few days I'll give the points to you MorFF.

OK ?
0
 
LVL 1

Author Comment

by:Jedi
ID: 1838511

->sybe
Sorry, but I can't give you an url.
but Tell me more...

Is there some way to prevent a page from beeing reloaded
when the refrsh button is hit ?
Can I put some Javascript in the page that will catch the reload event and throw it away ?

->jbirk
I'm not allowed to hide the toolbar in the browser !
Can I disalbe the reload button in the toolbar ?

0
 

Expert Comment

by:DavidME
ID: 1838512
If that is a vertical application, hacking a version of Netscape could do it but it is overkill, isn't it?

Why you can't send the 3 pages at the same time? Maybe you could do something in the server to deparallelize (?) the sending.
0
 
LVL 1

Author Comment

by:Jedi
ID: 1838513
Yes it's overkill...

The implementation uses a cookie to keep a session towards the application. The cookie is changed every request. If 3 requests comes at once, the first one is ok, but the second two will be rejected sice they are allowed until the first request is ready.
.

0
 
LVL 8

Expert Comment

by:jbirk
ID: 1838514
Well if it's timing with the cookies you're worried about, you could always use a mutual exclusion variable in the frameset to prevent all three frames from trying to access the cookie at the same time.  This is basic OS implementation and theory.
-jbirk
0
 

Expert Comment

by:DavidME
ID: 1838515
If you send the cookie with the frameset, you could keep the session from it.

I have to imagine that you want to change the cookie again for some reason.
0
 
LVL 11

Expert Comment

by:mouatts
ID: 1838516
If you want to ensure that the three frames always load in the same order and thus avoid the cookie problem then trap the onload event in the first frame to load the second frame and so on.
0
 
LVL 3

Expert Comment

by:MorFF
ID: 1838517
Just another suggestion;

Based on the fact that you are already using cookies.  Can you not dynamically update your cookie with info about each frame as it is updated/changed.  Then if 'reload' is pressed, use the onload event in each frame to check the cookie and refresh it accordingly.

MorFF
0
 
LVL 1

Author Comment

by:Jedi
ID: 1838518
That is exactly what I want to do.

When My application is started I load a frameset without a session. In the frameset I load the A frame with a session page, and the other two with blank no-session pages. The Session page loaded in frame A then loads the B frame with a session page, and then the Session page in frame B loads the third one with a session page...

When all frames are populated with Session pages, I cant have them all refreshed at the same time, I have to make it a sequence just as you explained and as I do when I start my application.

Could I see some sample code to test this ?
Then I'llgive you the points !

I have not figured out how to do this !

0
 
LVL 1

Author Comment

by:Jedi
ID: 1838519
Oh.. this last comment is to explain why I rejected mouatts answer.
I know what I want to to , but not how !
I need to know how to trap the Onload event and throw it away so that the request never hits the server unless I let it !

//Jedi


0
 
LVL 2

Expert Comment

by:Grdv
ID: 1838520
1) don't have time to write any source code, hopefully someone else has..
2) I'm no good with cookies, but I certainly consider that a wise idea...
all you have to do is to add:
onLoad="**javascript function to load the info from cookie**"
and
onUnload="**javascript function to put the info in a cookie**"

//Grdv
0
 
LVL 3

Expert Comment

by:MorFF
ID: 1838521
Sorry Jedi, no real cookie knowledge as yet, what I'm thinking tho' is the following 'pseudo code' in your various onloads

Frame A onload stuff
1) read cookie
2) if cookiestatus = B or C then do nothing
3) set cookie_status = B
4) write cookie
5) refresh Frame B based on content of Frame A

Frame B onload stuff
1) read cookie
2) if cookie_status <> B then do nothing
3) set cookie_status = C
4) write cookie
5) refresh Frame C based on content of Frame B

Frame C onload stuff
1) read cookie
2) if cookie_status <> C then do nothing
3) set cookie_status = A
4) write cookie

Hope this is of some help, apologies if this can't be done with cookies or I'm teaching you to suck eggs.

Cheers - MorFF
0
 
LVL 1

Author Comment

by:Jedi
ID: 1838522
OK Thanks MorFF but I can not handle the session cookie in the client browser, it's handled in the server.
Thats why I need to control the chain of requests that hit the server when the user presses the reload/refresh button.


I,ve done some testing ,

The onload event is trigged when the widow(frame) has been loaded with some new content. This is probably not the event for me. The request has already benn processed by the server and the damage is done !

I've discovered the onUnLoad event that occures before the window(frame) is loaded with new content.
Is this event something for me ?
What can be done at this time ?
Can I abort the newly requested load from the server ?
Delay it in some way ?
Woul be happy to get some info about this !
//Jedi
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 4

Expert Comment

by:rafistern
ID: 1838523
The asynchronous loading of pages is a feature of the internet for better or for worse..

Maybe you should try to tackle your problem without using frames.

If you must use frames then how about writing the frames using streams (a la document.open();document.write();document.close();) from the parent frame? Then when you hit the refresh you will have only one reload.
0
 

Expert Comment

by:DavidME
ID: 1838524
If I get it all right, you can not code the cookie handling in your CGI or ASP, because it is done by some piece of software that you can not control.

And you cannot add a cookie of your own that tells which phase (page) of the session the client is in?

Anyway, if you are trying to do it with Javascript on the server, are you sure that the client will be running a Javascript browser enabled to the version that you need?
0
 

Expert Comment

by:kafun
ID: 1838525
Well you could put a link to that page on the same page and put the TARGET="_self" atribute, then you will "reload" the page pressing the link to the same page, do you understand me?? well if no please say me ok?  

PD: Is your home page?
0
 
LVL 4

Expert Comment

by:rafistern
ID: 1838526
If you are using asp, then you could set the session object to react differently when you do your asynchronous refresh than when you submit requests.
0
 
LVL 1

Author Comment

by:Jedi
ID: 1838527
No understand
0
 
LVL 28

Expert Comment

by:sybe
ID: 1838528
Loading the pages from a frameset in the order you want can be done.

Make a frameset with just empty pages, displaying nothing.
In the frameset body, there is an "onLoad" that calls to replace the first page. The first page has an unLoad in the body, that calls to load the second page. Etc.

If you use cookies to store where the user was, it is possible to use those values to define which pages should be loaded.

See here some sample code:

=========
frameset
=========

<html>
<head>
<title>test</title>
<script>
var page1 = 'page1.htm';
var page2 = 'page2.htm';
var page3 = 'page3.htm';

function LoadFrame1() {
      frames[0].location = page1;
}
function LoadFrame2() {
      this.frames[1].location = page2;
}
function LoadFrame3() {
      this.frames[2].location = page3;
}

</script>

</head>
<frameset cols="100,100,*">
      <frame name="frame1" src="empty.htm">
      <frame name="frame2" src="empty.htm">
      <frame name="frame2" src="empty.htm">
</frameset>
<body onLoad="LoadFrame1();">

</body>
</html>

========
page1.htm
=======
<script>
function LoadNextPage() {
  parent.page2 = 'page2.htm';
  parent.LoadFrame2();
}
</script>

<body onLoad="LoadNextPage()">

=========




0
 
LVL 4

Expert Comment

by:rafistern
ID: 1838529
But when you hit the refresh, the other pages will refresh - maybe before the first page - hit the server and screw up its cookie.

Two solutions:
1. Using sybe's staged loading but with the server only serving new cookies if the request came via the first page.

2. Use the one document solution where the other frames are in fact content streamed from the first frame. Then there will only ever be one page request.

In the main frame:

<head>
<script>
data1="this is the first subsidiary frame"
data2="this is the second subsidiary frame"

function writeFrame(frameName,dataName){
  frameName.open();
  frameName.write(dataName);
  frameName.close();
}
</script>
</head>
<body onload="writeFrame(parent.frames[1],data1);writeFrame(parent.frames[2],data2);">
Whatever you put in the main frame
</body>

Now if data1 and data2 were generated by the asp/cgi script you get three frames generated all in one document.
0
 
LVL 1

Author Comment

by:Jedi
ID: 1838530
I already load the frames in a sequence when I run my application, this is not the problem.

The question worth 700 points were:
How can I make this sequence work when the user hits the reload/refresh button in the browser ?

My observations tells me:
When the user hits refresh/reload all the frames within the frameset reload their "current location" without any sequence.

This is what I must be able to control. Either by preventing 2 of the 3 frames from being reloaded when the user hits the button, or controling the sequence in which the frames are reloaded !

//Jedi
0
 
LVL 4

Expert Comment

by:rafistern
ID: 1838531
There is no way to do what you want.

To reiterate:
You must either
1. not reset the cookie on every hit, rather only on hits from the right page (test for Request.ServerVariables("HTTP_REFERER") using ASP or $ENV{"HTTP_REFERER"} with Perl).
2. contain all the data in one page as I suggested above in order that there is only one page hit each refresh

You cannot:
1. affect the asynchronous loading of pages.
2. annul refresh for specific frames.

Rafi
0
 
LVL 28

Expert Comment

by:sybe
ID: 1838532
The problem is that the frameset is reloaded from cache, and that the other pages are aware of that.

When I click reload on a frameset that is produced by a cgi or ASP, then the original frameset (as stated in the frameset) is reloaded, not the pages in the frames where I eventually have linked to.

So, make the frameset not-cachable (write from CGI/ASP), set cookies to remember where the user was (or serverside variables) and set the order in which the frames are loaded in the way you are already doing.



0
 
LVL 4

Expert Comment

by:rafistern
ID: 1838533
That could work..
0
 
LVL 2

Expert Comment

by:Laphroaig
ID: 1838534
Hello Jedi,

This might sound a bit simple, but my ISP where I host my website has an online filter that allows me to select or deselect various events including 'User requested Refresh'. This allows me to put 'Refresh' hyperlinks on each frame so that the user can only update the relevent frame content by using the hyperlinks that I've placed in the HTML content of my site. That gives me total control of the site, and allows me to disable any unexpected events by a user, by filtering out their commands that I have no control over, using the ISP's filter.

Your ISP should provide the same service so speak to them. If they dont, then I can down load a copy of this CGI app and send it on to you. You should then be able to upload it to your Service provider.

Cheers.

Laphroaig.


0
 
LVL 1

Author Comment

by:Jedi
ID: 1838535
->Laphroaig
Have investigated it, I can not use it

0
 
LVL 28

Expert Comment

by:sybe
ID: 1838536
Jedi,

Did you try my suggestion (see above) ? make the frameset from a CGI/ASP, so that it won't be cached.
0
 
LVL 1

Author Comment

by:Jedi
ID: 1838537
I don't think this is a soulution...

I use a frameset (normal htm) when I hit the refresh all the frames are reloaded with their "current content". This is actually the problem, that the browser seems to be aware of all the frames and their location.

If the browser would act as you state: When the refresh button is clicked, the frameset is reloaded as it was initiated.(just a reload of the htm file defining the frameset) then I would not have this problem.

( I use Explorer 4 and Netscape 4 on a WIN 32 platform )
  Is this a new behaviour from the browers ?,
  or has it alwaysbeen like this ?
0
 
LVL 1

Author Comment

by:Jedi
ID: 1838538
My frist page (the frameset definition) contains three frames two of them are emty pages(B,C) and one is an active one(A). The avtive one starts the loading sequece of the other frames....Frame A loads FrameB which loads FrameC...

If the users refresh/reload would target my first page(frameset definition) I would be very happy, because then I would have control over the sequence.

Correct me if I'm wrong , but this is not what is happening when the user hits the refresh/reload button ?
All the frames are reloaded from their current location !

0
 
LVL 28

Accepted Solution

by:
sybe earned 700 total points
ID: 1838539
Well, that is exactly what I say:

Don't use "normal.htm" as a frameset, because that is cached.
Make a frameset using CGI/ASP, so:
"normal.asp", or "normal.pl". The HTML-output of course should be the same as in "normal.htm", but as it is a CGI, on a reload, the browser will not use the cached version, and will not reload the frames from their current location.

To repeat your phrase:

>This is actually the problem, that the browser seems to be aware of all the frames and their location.

This is solved using the solution I propose.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

757 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

19 Experts available now in Live!

Get 1:1 Help Now