Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > refreshing iframes causes problem

Reply
Thread Tools

refreshing iframes causes problem

 
 
Jarrod
Guest
Posts: n/a
 
      04-25-2004
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



 
Reply With Quote
 
 
 
 
SpaceGirl
Guest
Posts: n/a
 
      04-25-2004

"Jarrod" <(E-Mail Removed)> wrote in message
news:RwLic.54$zc3.50@newsfe1-win...
> 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.


 
Reply With Quote
 
 
 
 
Jarrod
Guest
Posts: n/a
 
      04-25-2004
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!


"SpaceGirl" <(E-Mail Removed)> wrote in message
news:c6g2ou$bi91p$(E-Mail Removed)-berlin.de...
>
> "Jarrod" <(E-Mail Removed)> wrote in message
> news:RwLic.54$zc3.50@newsfe1-win...
> > 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.
>
>



 
Reply With Quote
 
SpaceGirl
Guest
Posts: n/a
 
      04-25-2004

>
> "SpaceGirl" <(E-Mail Removed)> wrote in message
> news:c6g2ou$bi91p$(E-Mail Removed)-berlin.de...
> >
> > "Jarrod" <(E-Mail Removed)> wrote in message
> > news:RwLic.54$zc3.50@newsfe1-win...
> > > 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.
> >
> >



"Jarrod" <(E-Mail Removed)> wrote in message
news:AwWic.229$(E-Mail Removed)...
> 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


 
Reply With Quote
 
Jack Cheng
Guest
Posts: n/a
 
      08-08-2004

"SpaceGirl" <(E-Mail Removed)> wrote in message
news:c6hhd5$c0s92$(E-Mail Removed)-berlin.de...
>
> >
> > "SpaceGirl" <(E-Mail Removed)> wrote in message
> > news:c6g2ou$bi91p$(E-Mail Removed)-berlin.de...
> > >
> > > "Jarrod" <(E-Mail Removed)> wrote in message
> > > news:RwLic.54$zc3.50@newsfe1-win...
> > > > 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.
> > >
> > >

>
>
> "Jarrod" <(E-Mail Removed)> wrote in message
> news:AwWic.229$(E-Mail Removed)...
> > 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
>


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


 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      08-08-2004
in post: <news:JHwRc.7852$(E-Mail Removed) ink.net>
Jack Cheng <(E-Mail Removed)> 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.

--
i h e a r v o i c e s

 
Reply With Quote
 
SpaceGirl
Guest
Posts: n/a
 
      08-08-2004
brucie wrote:

> in post: <news:JHwRc.7852$(E-Mail Removed) ink.net>
> Jack Cheng <(E-Mail Removed)> 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.
>


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 #
 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      08-08-2004
in post: <news:(E-Mail Removed)>
SpaceGirl <(E-Mail Removed)> 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.


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


--
i h e a r v o i c e s

 
Reply With Quote
 
SpaceGirl
Guest
Posts: n/a
 
      08-08-2004
brucie wrote:

>>That depends on many things.

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

>>For example, in FireFox,

>
>
> 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 #
 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      08-08-2004
in post: <news:(E-Mail Removed)>
SpaceGirl <(E-Mail Removed)> 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?

--
i h e a r v o i c e s

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refreshing the page causes resubmission the form ritika_v ASP .Net 1 04-01-2008 02:18 PM
Self-refreshing and non-self-refreshing controls Harlan Messinger ASP .Net 1 08-04-2006 01:13 PM
Self-refreshing and non-self-refreshing controls Harlan Messinger ASP .Net Web Controls 0 08-03-2006 12:29 PM
Refreshing a page causes databound gridview to re update datasource. Mike Grace ASP .Net 1 05-12-2006 04:01 AM
Refreshing Iframes Antonio Delgado HTML 0 08-18-2003 06:53 PM



Advertisments