Results 1 to 15 of 15

Thread: [GIVEN UP / RESOLVED] Reload when '#text' part changes

  1. #1

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Resolved [GIVEN UP / RESOLVED] Reload when '#text' part changes

    title says it all really - how would i go about reloading the page when the text following the # changes. e.g.

    http://www.bushmobile.com/info.html#about

    user changes it (via a link or by hand) to:

    http://www.bushmobile.com/info.html#stuff

    and i would like the page to reload.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Reload when '#text' part changes

    You can't. Any text after the hash sign should not be sent by the browser, and if it is, is ignored by the server.

  3. #3

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Reload when '#text' part changes

    bugger.

    ok, in that case is it possible force a browser to refresh when i click on a link.

    e.g. I've got:
    HTML Code:
    <a href="http://www.bushmobile.com/info.html">Info</a>
    and i want it to reload the page even if http://www.bushmobile.com/info.html is already showing.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Reload when '#text' part changes

    Might have misunderstood your question slightly. If I get you, you will need to use Javascript to manually reload the page. I am not sure however if there is an event that fires if the bookmark part of the URL changes. I don't think there is.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Reload when '#text' part changes

    Quote Originally Posted by bushmobile
    bugger.

    ok, in that case is it possible force a browser to refresh when i click on a link.

    e.g. I've got:
    HTML Code:
    <a href="http://www.bushmobile.com/info.html">Info</a>
    and i want it to reload the page even if http://www.bushmobile.com/info.html is already showing.
    It should do that anyway.

    If not, you could try putting a randomised query string after it.

    http://www.bushmobile.com/info.html?abcdef123456

  6. #6

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Reload when '#text' part changes

    hmmm, that's true, it should.

    what i'm actually trying to do is get the page to reload when the user clicks:
    http://www.bushmobile.com/info.html#about
    and then clicks:
    http://www.bushmobile.com/info.html#stuff

    i guess the browser doesn't bother reloading if it sees that just the bookmark has changed, so is there anyway i could force it to?

    Edit: I'd love to use a query string but this god damn template thing won't let me - i'm trying to fudge it as it lets the bookmarks through.

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Reload when '#text' part changes

    Yes, put different meaningless query strings into the target URLs.

    http://www.bushmobile.com/info.html?1#about
    http://www.bushmobile.com/info.html?2#stuff

  8. #8
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Reload when '#text' part changes

    Eh, well, that's the only way I can think of.

    Other way is to switch to a different template system

  9. #9

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Reload when '#text' part changes

    it's just me trying to be conservative with the templates - i guess i'll just have to use one for everypage... oh well

  10. #10
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Reload when '#text' part changes

    How is the page going to be any different if all you change is the bit that doesn't get sent to the server?

  11. #11

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Reload when '#text' part changes

    i was parsing it in the onLoad event (don't hate me)


  12. #12
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Reload when '#text' part changes

    Hate is a subjective term.

    Nevertheless, if you're using JS, might as well not reload the page at all.

    Buuut, you still need proper separate pages, as well as one all-in-one JS thingo. Otherwise you exclude people who can't run Javascript.

  13. #13

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Reload when '#text' part changes

    Quote Originally Posted by penagate
    Nevertheless, if you're using JS, might as well not reload the page at all.
    at the moment my text is in span tags which are all set to display:none and based on the value after the # i was showing the relevant one using JS. Bearing in mind that all i have control over is the html on the page i couldn't think of another way - how will i know which one i should show?

    Quote Originally Posted by penagate
    Buuut, you still need proper separate pages, as well as one all-in-one JS thingo. Otherwise you exclude people who can't run Javascript.
    what do you mean by all-in-one thingo?

  14. #14
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Reload when '#text' part changes

    All in one being the approach you are using now.

    What you could do, and this is starting to get ugly, is add event listeners to each anchor element with a #reference, when the page loads, and then in that event handler, show and hide the appropriate content elements.

  15. #15

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Reload when '#text' part changes

    meh, i think i'm gonna give up - just gonna use the Anchor tags as they were meant to be used - cheers for the input, pen.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width