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

Discussion in 'HTML' started by Joshua Beall, Oct 20, 2004.

  1. Joshua Beall

    Joshua Beall Guest

    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
     
    Joshua Beall, Oct 20, 2004
    #1
    1. Advertising

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

    Joshua Beall wrote:
    > 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?
     
    Leif K-Brooks, Oct 20, 2004
    #2
    1. Advertising

  3. Joshua Beall

    Kris Guest

    In article <PSxdd.1304$qr.672@trnddc05>,
    "Joshua Beall" <> wrote:

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

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

    --
    Kris
    <> (nl)
     
    Kris, Oct 20, 2004
    #3
  4. Joshua Beall

    Joshua Beall Guest

    "Leif K-Brooks" <> wrote in message
    news:...
    > Joshua Beall wrote:
    >> 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?


    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.
     
    Joshua Beall, Oct 20, 2004
    #4
  5. Joshua Beall

    Joshua Beall Guest

    "Kris" <> wrote in message
    news:4all.nl...
    > In article <PSxdd.1304$qr.672@trnddc05>,
    > "Joshua Beall" <> wrote:
    >
    >> >> <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?

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


    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
     
    Joshua Beall, Oct 20, 2004
    #5
  6. On Wed, 20 Oct 2004 17:55:07 +0000, Joshua Beall wrote:

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

    --
    Jeffrey D. Silverman |
    Website | http://www.newtnotes.com

    Drop "PANTS" to reply by email
     
    Jeffrey Silverman, Oct 20, 2004
    #6
  7. On Wed, 20 Oct 2004 17:55:07 +0000, Joshua Beall wrote:

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

    --
    Jeffrey D. Silverman |
    Website | http://www.newtnotes.com

    Drop "PANTS" to reply by email
     
    Jeffrey Silverman, Oct 20, 2004
    #7
  8. On Wed, 20 Oct 2004 18:22:04 +0000, Joshua Beall wrote:

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


    See my second post.

    --
    Jeffrey D. Silverman |
    Website | http://www.newtnotes.com

    Drop "PANTS" to reply by email
     
    Jeffrey Silverman, Oct 20, 2004
    #8
  9. Joshua Beall

    Kris Guest

    In article <g1ydd.1307$qr.434@trnddc05>,
    "Joshua Beall" <> wrote:

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


    What purpose does the dialog serve?

    --
    Kris
    <> (nl)
     
    Kris, Oct 20, 2004
    #9
  10. Joshua Beall

    Joshua Beall Guest

    "Jeffrey Silverman" <> wrote in message
    news:p...
    > 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.
     
    Joshua Beall, Oct 20, 2004
    #10
  11. Joshua Beall

    Joshua Beall Guest

    "Jeffrey Silverman" <> wrote in message
    news:p...
    > On Wed, 20 Oct 2004 17:55:07 +0000, Joshua Beall wrote:
    >
    >> 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>


    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?
     
    Joshua Beall, Oct 20, 2004
    #11
  12. Joshua Beall

    Joshua Beall Guest

    "Kris" <> wrote in message
    news:4all.nl...
    > In article <g1ydd.1307$qr.434@trnddc05>,
    > "Joshua Beall" <> wrote:
    >> But rather than get involved in a philosophical debate over this, can
    >> anyone
    >> tell me how to refresh a modal dialog?

    >
    > 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.
     
    Joshua Beall, Oct 20, 2004
    #12
  13. On Wed, 20 Oct 2004 18:31:55 +0000, Joshua Beall wrote:

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

    --
    Jeffrey D. Silverman |
    Website | http://www.newtnotes.com

    Drop "PANTS" to reply by email
     
    Jeffrey Silverman, Oct 20, 2004
    #13
  14. Joshua Beall

    Karl Core Guest

    "Jeffrey Silverman" <> wrote in message
    news:p...
    > On Wed, 20 Oct 2004 18:31:55 +0000, Joshua Beall wrote:
    >
    >> 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?
    >


    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
     
    Karl Core, Oct 20, 2004
    #14
  15. Joshua Beall

    SpaceGirl Guest

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

    Joshua Beall wrote:

    > 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 #
     
    SpaceGirl, Oct 20, 2004
    #15
  16. Joshua Beall

    Kris Guest

    In article <Qiydd.1311$qr.468@trnddc05>,
    "Joshua Beall" <> wrote:

    > >> tell me how to refresh a modal dialog?

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


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

    --
    Kris
    <> (nl)
     
    Kris, Oct 20, 2004
    #16
  17. On Wed, 20 Oct 2004 17:02:29 -0400, Karl Core wrote:

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

    --
    Jeffrey D. Silverman |
    Website | http://www.newtnotes.com

    Drop "PANTS" to reply by email
     
    Jeffrey Silverman, Oct 21, 2004
    #17
  18. Jeffrey Silverman <> wrote in message news:<>...
    > 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.

    --
    Dan
     
    Daniel R. Tobias, Oct 21, 2004
    #18
  19. "Joshua Beall" <> wrote in message news:<%Dxdd.1303$qr.1066@trnddc05>...
    > <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.

    --
    Dan
     
    Daniel R. Tobias, Oct 21, 2004
    #19
  20. Joshua Beall

    Joshua Beall Guest

    "Jeffrey Silverman" <> wrote in message
    news:p...
    > On Wed, 20 Oct 2004 17:02:29 -0400, Karl Core wrote:
    >
    >> 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?


    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
     
    Joshua Beall, Oct 21, 2004
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CRON
    Replies:
    24
    Views:
    203,756
    Adrienne Boswell
    Jun 20, 2006
  2. Mike
    Replies:
    0
    Views:
    230
  3. Replies:
    2
    Views:
    628
  4. Vincent van Beveren

    BASE HREF and A HREF="#" onclick="..."

    Vincent van Beveren, Jul 6, 2006, in forum: Javascript
    Replies:
    2
    Views:
    426
    Vincent van Beveren
    Jul 6, 2006
  5. kelvlam
    Replies:
    6
    Views:
    374
    kelvlam
    Jul 18, 2006
Loading...

Share This Page