JavaScript refresh: <a href="#" onClick="window.location.reload( true );">Reload</a>

J

Joshua Beall

Hi All,

I am using

<a href="#" onClick="window.location.reload( true );">Reload</a>

And I thought it would cause the page to refresh. No go. Any pointers?

Sincerely,
-Josh
 
L

Leif K-Brooks

Joshua said:
I am using

<a href="#" onClick="window.location.reload( true );">Reload</a>

And I thought it would cause the page to refresh. No go. Any pointers?

What's wrong with my browser's reload button?
 
K

Kris

What's wrong with my browser's reload button?

It's in a modal dialog box that displays an HTML page, so there is no reload
button; it's barely even a browser.

Anyway, apparently the fact that it is a modal dialog box is the reason that
the reload JS isn't working. I could just insist the browser close and
reopen the dialog in order to refresh, but I was hoping to have another way
to do it.[/QUOTE]

Why not stop opening new windows and thus no longer stack up your
problems?
 
J

Joshua Beall

Leif K-Brooks said:
What's wrong with my browser's reload button?

It's in a modal dialog box that displays an HTML page, so there is no reload
button; it's barely even a browser.

Anyway, apparently the fact that it is a modal dialog box is the reason that
the reload JS isn't working. I could just insist the browser close and
reopen the dialog in order to refresh, but I was hoping to have another way
to do it.
 
J

Joshua Beall

Kris said:
It's in a modal dialog box that displays an HTML page, so there is no
reload
button; it's barely even a browser.

Anyway, apparently the fact that it is a modal dialog box is the reason
that
the reload JS isn't working. I could just insist the browser close and
reopen the dialog in order to refresh, but I was hoping to have another
way
to do it.

Why not stop opening new windows and thus no longer stack up your
problems?[/QUOTE]

I understand, and usually sympathize with, the attitude that you should not
have a link open in a new window. However, there are exceptions, and I
believe this is one of them.

I am working on an editor application, and the modal dialog that I am
speaking of is what you get when you click on one of the option links. The
whole system is designed to be similar to what you would get in a word
processor if you pulled up an option dialog. Should the text you are
currently working on disappear, and be replaced with the option dialog? No,
that would be silly. Instead, you get the option dialog on top of your
current project, and as soon as you make your choices, it goes away.

But rather than get involved in a philosophical debate over this, can anyone
tell me how to refresh a modal dialog?

-Josh
 
J

Jeffrey Silverman

Hi All,

I am using

<a href="#" onClick="window.location.reload( true );">Reload</a>

And I thought it would cause the page to refresh. No go. Any pointers?

Sincerely,
-Josh

Stop using it. Let the user use the "Refresh" button built into their
browser.
 
J

Jeffrey Silverman

Hi All,

I am using

<a href="#" onClick="window.location.reload( true );">Reload</a>

And I thought it would cause the page to refresh. No go. Any pointers?

Sincerely,
-Josh

hm. But if you really want to use it, try:

<a href="#" onClick="window.location.reload();return false;">Reload</a>
 
K

Kris

Why not stop opening new windows and thus no longer stack up your
problems?

I understand, and usually sympathize with, the attitude that you should not
have a link open in a new window. However, there are exceptions, and I
believe this is one of them.

I am working on an editor application, and the modal dialog that I am
speaking of is what you get when you click on one of the option links. The
whole system is designed to be similar to what you would get in a word
processor if you pulled up an option dialog. Should the text you are
currently working on disappear, and be replaced with the option dialog? No,
that would be silly. Instead, you get the option dialog on top of your
current project, and as soon as you make your choices, it goes away.

But rather than get involved in a philosophical debate over this, can anyone
tell me how to refresh a modal dialog?[/QUOTE]

What purpose does the dialog serve?
 
J

Joshua Beall

Jeffrey Silverman said:
Stop using it. Let the user use the "Refresh" button built into their
browser.

See my response to Kris. This is a modal dialog, so there is no refresh
button.

If there is a way to put the refresh button on a modal dialog, please tell
me. I don't care about the mechanics, I just want a way to allow the user
to refresh the dialog.
 
J

Joshua Beall

Jeffrey Silverman said:
hm. But if you really want to use it, try:

<a href="#" onClick="window.location.reload();return false;">Reload</a>

Still no go. I think the real problem here is that it is a modal dialog
box. Surely there is some way to allow the user to refresh a modal dialog?
 
J

Joshua Beall

Kris said:
What purpose does the dialog serve?

They can choose an image to insert back into their document. The reason I
would like to be able to refresh this dialog is so that users can see any
new files that have been uploaded to the server without closing and
reopening the dialog.

The mechanics of how the file got there aren't particularly important -
maybe the user uploaded it himself via FTP, maybe somebody else put it
there, whatever. The point is, I would like to give the user the option of
refreshing to check for new images, rather than having to close and reopen
the dialog.
 
J

Jeffrey Silverman

Still no go. I think the real problem here is that it is a modal dialog
box. Surely there is some way to allow the user to refresh a modal dialog?

Then I am confused as to what you mean by "modal dialog". What is this to
which you refer?
 
S

SpaceGirl

Joshua said:
Hi All,

I am using

<a href="#" onClick="window.location.reload( true );">Reload</a>

And I thought it would cause the page to refresh. No go. Any pointers?

Sincerely,
-Josh

The problem with your attempted method is you might get caught in the
cache anyway, so the user may never see new files.

A better trick would be to do something like:

onclick="self.location='thispage.htm?somerandomstringhere';"

By passing a random string, it forces the server to always do something
(even if in doing something it actually does nothing, if you see what I
mean) and in turn bypasses the local cache. Even if you completely
ignore the string, it should still force the browser to try fetch a new
page because it thinks the url is different.


--


x theSpaceGirl (miranda)

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

Kris

What purpose does the dialog serve?

They can choose an image to insert back into their document. The reason I
would like to be able to refresh this dialog is so that users can see any
new files that have been uploaded to the server without closing and
reopening the dialog.

The mechanics of how the file got there aren't particularly important -
maybe the user uploaded it himself via FTP, maybe somebody else put it
there, whatever. The point is, I would like to give the user the option of
refreshing to check for new images, rather than having to close and reopen
the dialog.[/QUOTE]

<form action="modaldialog.php" method="get">
<div>
<input type="submit" name="q" value="Refresh">
</div>
</form>

You could put in the returned list of images with some widgets to let
the user remove some and stuff like that. Make it a bit more useful.

It this what you are looking for?
 
J

Jeffrey Silverman

In this context (considering that the OP has mentioned JavaScript) it is IE
specific crap.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2282&lngWId=10

-Karl

I see. So the OP could even use, say, a Javascript new window (i.e.
window.open()) to open, say, a modal dialog that is really an HTML page,
and thus have a web app that would actually (1) work in most browsers and
(2) solve all of his problems with Javascript control over the dialog
window?

hmmm....
 
D

Daniel R. Tobias

Jeffrey Silverman said:
On Wed, 20 Oct 2004 17:55:07 +0000, Joshua Beall wrote:
Stop using it. Let the user use the "Refresh" button built into their
browser.

It's called "Reload" on *my* browser.
 
D

Daniel R. Tobias

Joshua Beall said:
<a href="#" onClick="window.location.reload( true );">Reload</a>

And I thought it would cause the page to refresh. No go. Any pointers?

Using "#" as a href value is almost never a good idea, as it doesn't
degrade gracefully for non-JavaScript users; it's better to have the
href go to something meaningful. If, for some reason, you *do* need
to use the "#" value, the JavaScript event should end with "return
false" so that the browser never actually follows the "#" link and
jumps to the top of the page.
 
J

Joshua Beall

Jeffrey Silverman said:
I see. So the OP could even use, say, a Javascript new window (i.e.
window.open()) to open, say, a modal dialog that is really an HTML page,
and thus have a web app that would actually (1) work in most browsers and
(2) solve all of his problems with Javascript control over the dialog
window?

If I was writing this app from scratch, then yes. What I am actually doing
is adding a small component to an existing JS editor, and it already is IE
specific.

Just for the record, here's what I am working on:
http://www.interactivetools.com/products/htmlarea/ - I am using v2.0.3

I would like to use v3.0, which works in Mozilla as well as IE, but I've had
it crash the browser more than once. I'll have to wait for it to get a
little more stable.

-Josh
 

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,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top