refreshing iframes causes problem

J

Jarrod

Hi all,

I have a bit of a problem.

I have several iframes in a page which load successively after the parent
page loads. The idea was to load all my javascript objects and data THEN
load the pages that need the data after that. It works fine the on the first
load, but when you refresh or navigate back then forward, all of the frames
and main page seem to loading at once, which causes an error because the
iframes are trying to access data that essentially doesn't exist yet. I have
tried things like checking for the data and relocating if it doesn't exist,
but that then puts the page in the history.

What I want to happen is for the main page to reload/refresh as it would the
first time. It there a way to "turn off" the frame or something (sorry that
is stupid terminology, but...well you know.)

Also, something that might be linked. I have put alerts in some of the pages
and they seem to be getting loaded more than once. I don't quite get what is
happening, but I think that the fundamental problem is that I don't
understand how the loading of frames work.

Any help would be appreciated,

Jarrod
 
S

SpaceGirl

Jarrod said:
Hi all,

I have a bit of a problem.

I have several iframes in a page which load successively after the parent
page loads. The idea was to load all my javascript objects and data THEN
load the pages that need the data after that. It works fine the on the first
load, but when you refresh or navigate back then forward, all of the frames
and main page seem to loading at once, which causes an error because the
iframes are trying to access data that essentially doesn't exist yet. I have
tried things like checking for the data and relocating if it doesn't exist,
but that then puts the page in the history.

What I want to happen is for the main page to reload/refresh as it would the
first time. It there a way to "turn off" the frame or something (sorry that
is stupid terminology, but...well you know.)

Also, something that might be linked. I have put alerts in some of the pages
and they seem to be getting loaded more than once. I don't quite get what is
happening, but I think that the fundamental problem is that I don't
understand how the loading of frames work.

Any help would be appreciated,

Jarrod


Sounds to me like you should move all the data from client- to server-side
and loose all these issues. You could assign all the data to variables in
whichever server side language your hosts supports, and have each frame read
the contents of these variables (or, pass them as querystring variables
between each frame). There are plenty of ways of doing this, but trying to
manipulate data client side is asking for trouble. If the users browser
behaves slightly differently, or they have script blocking turned on, what
happens to your page? If you handle all your data server side, then there's
not much the user can do to f*ck up your design.
 
J

Jarrod

Thanks for the info. I will take it onboard (not that I live in a boat). My
last design was serverside, and I was just trying to minimise http request
and download of web content, but I guess I will have to go back and re-jig
the old model.

Do you have any ideas on the actual problem of reloading frame pages? It is
kind of annoying me anyway apart from my problem.

Thanks again Spacegirl!
 
S

SpaceGirl

Jarrod said:
Thanks for the info. I will take it onboard (not that I live in a boat). My
last design was serverside, and I was just trying to minimise http request
and download of web content, but I guess I will have to go back and re-jig
the old model.

Do you have any ideas on the actual problem of reloading frame pages? It is
kind of annoying me anyway apart from my problem.

Thanks again Spacegirl!

Not sure there is any easy way around it. Different browsers handle the back
button in different ways (hmm well, it depends), and you really don't want
to break the way the browser works just to get around a code glitch. The
reason everything loads at once is that the pages are being pulled from
cache, rather than the server, which puts all of your stuff out of sync, I
suspect. How about you write the data to a cookie, and read it? You could
easily script the page to check for existence of data in the cookie, meaning
that you could tell if the user had hit back in their browser etc. You could
then control the behaviour of the frames.

I'm not particularly in the "frames are bad" gang, but this one example of
why handling frames has to be done very carefully if you must use them. We
have one site we're just finishing up that uses several iframes, which are
dynamically generated. The client also wanted users to be able to just enter
a folder, and for the site to display the correct page in the correct place
on their iframed console. We couldn't have done it purely client side... in
the end we worked out a method that rebuilds the frameset dynamically - or
completely from scratch if a user tried to end a daughter page directly. It
got complicated quickly with all of our other scripts, but thankfully the
whole lot was pretty much server side, so we wrote a module to handle it
(especially if the client changes their mind, we'd be in trouble).

miranda
 
J

Jack Cheng

SpaceGirl said:
yet. trying browser




Not sure there is any easy way around it. Different browsers handle the back
button in different ways (hmm well, it depends), and you really don't want
to break the way the browser works just to get around a code glitch. The
reason everything loads at once is that the pages are being pulled from
cache, rather than the server, which puts all of your stuff out of sync, I
suspect. How about you write the data to a cookie, and read it? You could
easily script the page to check for existence of data in the cookie, meaning
that you could tell if the user had hit back in their browser etc. You could
then control the behaviour of the frames.

I'm not particularly in the "frames are bad" gang, but this one example of
why handling frames has to be done very carefully if you must use them. We
have one site we're just finishing up that uses several iframes, which are
dynamically generated. The client also wanted users to be able to just enter
a folder, and for the site to display the correct page in the correct place
on their iframed console. We couldn't have done it purely client side... in
the end we worked out a method that rebuilds the frameset dynamically - or
completely from scratch if a user tried to end a daughter page directly. It
got complicated quickly with all of our other scripts, but thankfully the
whole lot was pretty much server side, so we wrote a module to handle it
(especially if the client changes their mind, we'd be in trouble).

miranda

I think it is possible to stop the browser from caching a page with meta
tags.
 
B

brucie

in post: <
Jack Cheng said:
I think it is possible to stop the browser from caching a page with meta
tags.

its not, ultimately its up to the visitor if something is cached or not.
 
S

SpaceGirl

brucie said:
in post: <


its not, ultimately its up to the visitor if something is cached or not.

That depends on many things. For example, in FireFox, if you try to
force caching off via your page (preferably via an HTTP header, rather
than in hte markup), the page files (images etc) are still written to
disc. However they dont appear to be refered to. If you then loose your
internet connection... Firefox would repaint the page from disc *unless*
the page has dynamic data, at which point the HTTP response would fail....

Not sure how up to the visitor this is, as it's all happening blindly!

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
B

brucie

in post: <
That depends on many things.

no it doesn't. its your computer, you control what gets downloaded or
not and what happens with it.
For example, in FireFox,

its easiest to make any changes you want before the goodies get to the
browser.
 
S

SpaceGirl

brucie said:
no it doesn't. its your computer, you control what gets downloaded or
not and what happens with it.

You missed my point. Not everyone knows how to control these things on
thier browsers. While you and I know you CAN do these things doesn't
mean that other people know how to, or are inclined to.

As the average IE user and they probably wouldn't know what the ****
"cache" was in the first place, so how can they control it? :)
its easiest to make any changes you want before the goodies get to the
browser.

Uh huh... caching and dynamic forms is a pain in the arse though :( It's
a shame there is no sure fire way of controlling them. Ah well.

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
B

brucie

in post: <
SpaceGirl said:
You missed my point. Not everyone knows how to control these things on
thier browsers.

that doesn't mean that the visitor is not ultimately in control of
something being cached or not - which they are and is what i said.
As the average IE user

please use the correct terminology - "trailer trash"
and they probably wouldn't know what the ****

i like it when you talk dirty
"cache" was in the first place, so how can they control it? :)

RTFM?
 
S

SpaceGirl

brucie said:
that doesn't mean that the visitor is not ultimately in control of
something being cached or not - which they are and is what i said.

Only in as much as they could not turn their computer on I guess. Then
they dont have to worry about those nasty virus either!
please use the correct terminology - "trailer trash"

or "your customers".
i like it when you talk dirty

Ah baby, you've not heard anything yet :p

Yeha right lol


--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
B

brucie

in post: <
SpaceGirl said:
Only in as much as they could not turn their computer on I guess. Then
they dont have to worry about those nasty virus either!

if people get infected then its their own fault. its their computer
they're in control.
or "your customers".

"trailer trash customers" - cash only
Yeha right lol

i can dream
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top