SitePoint Sponsor

User Tag List

Results 1 to 17 of 17
  1. #1
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know that you could, and I certainly wouldn't recommend doing so...I know that if it were to happen to me, I'd be more than a little ticked off.



    ------------------
    Chris Bowyer chris@mycoding.com
    MyCoding.com: Visit for Launch Notification!
    DomainMailings.com: Who Says All The Good Ones Are Taken?
    MovieForums.com: Talk About Your Favorite Flicks!

  2. #2
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahhhhh. Once again this topic has come up, why on earth do you want to disable the back button? It is pointless and would make me and the fast majority of surfers exit your site straight away.

    ------------------
    Karl Austin
    KDA Web Services
    "Everyone has a photographic memory. Some just don't have film."

  3. #3
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how could I disable the browser's back button using javascript?


    sam

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    About the only way you can do this is to open a new window using window.open() (specifying that the browser history should not be copied to the new window) and then close the existing one.

    As others have already pointed out, however, there doesn't seem to be any good reason to do this.

    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

  5. #5
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    If you are concerned that someone will resubmit a form or be out of sequence if they use the back button, you could reset the form elements upon loading the document. Or you can check if history.go(1) is equal to a known document. In which case you can put up an alert. But, kill the button? Nope.
    Vinny

    ------------------
    my site:GrassBlade: cut&paste javascript
    moderator at:The JavaScript Place Forums
    Javascript City

  6. #6
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    so no one knows how to do this huh?

    sam

  7. #7
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I DON'T NEED ADVICE!!

    ALL THAT I ASK IS IF THERE IS A WAY TO DISABLE THE BACK BUTTON...

    i'm not asking for too much, right?





    Sam

  8. #8
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Chill out...we're simply making it clear that there so far, between the people who have posted, there's no conceivable appropriate use for this. The fact that you seem so upset with this makes me question why you're even inquiring...

    And of course, as Kevin said, there's only one way he knows of, and he's a major guru in this sort of area.

    This may sound rude, but if I *did* know how to do this, I'd probably request more info before telling you how...this could be used in less-than-moral ways for adult sites and such...


    ------------------
    Chris Bowyer chris@mycoding.com
    MyCoding.com: Visit for Launch Notification!
    DomainMailings.com: Who Says All The Good Ones Are Taken?
    MovieForums.com: Talk About Your Favorite Flicks!

  9. #9
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i wasn't mad, just that i wanted an answer.

    it's not going to be used for a porn site or any public domain, in fact it will be used for an e-business application that will be hosted on my company's intranet.

    no ethics in question, just a simple back button...

    thanks anyway.

    Sam

  10. #10
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Sam,

    Again, I don't know of any method per se, but why is it important and maybe i can point you in a different but equally effective direction
    Vinny

    ------------------
    my site:GrassBlade: cut&paste javascript
    moderator at:The JavaScript Place Forums
    Javascript City

  11. #11
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Although I'm not in the habit of repeating myself...

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>About the only way you can do this is to open a new window using window.open() (specifying that the browser history should not be copied to the new window) and then close the existing one.<HR></BLOCKQUOTE>

    If that solution isn't acceptable to you, you'll have to do without. For security reasons, JavaScript provides no way to do what you want. Sorry.



    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

  12. #12
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It can be done in 4+ browsers but it doesn't really disable the back button, just erases the data behind it to an extant.

    replace Method
    The replace method replaces the current History entry with the specified URL. After calling the replace method, you cannot navigate back to the previous URL using the browser's Back button.

    Syntax: location.replace(URL)

    This will replace the history with the current link every time a link is clicked
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    &lt;SCRIPT&gt;
    function getTag(el,str) {
    while ((el!=null) && (str.indexOf(el.tagName + ":")&lt;0))
    el = el.parentElement
    return el
    }

    function navigateTo(sURL,target) {
    if ((target == '_self') | | (target=="")) {
    window.location.replace(sURL);
    return false;
    }
    if (target == '_top') {
    top.window.location.replace(sURL);
    return false
    }
    if (target =='_parent') {
    parent.window.location.replace(sURL);
    return false;
    }
    if (target == '_blank' | | parent.frames.length &lt; 1) {
    window.open(sURL, target);
    return false;
    }
    else {
    if (parent.frames[target])
    parent.frames[target].location.replace(sURL);
    else
    window.open(sURL, target);
    return false;
    }
    }

    function checkIEClick() {
    var el = getTag(event.srcElement,"A:AREA:")
    if ((el!=null) && ((el.tagName=="A") | | (el.tagName=="AREA"))) {
    event.returnValue = false
    navigateTo(el.href,String(el.target).toLowerCase())
    }
    }

    function checkNSClick(ev) {
    if (ev.target.href) {
    navigateTo(ev.target.href,String(ev.target).toLowerCase())
    return false
    }

    }

    if ((document.all) | | (document.layers))
    if (document.layers) {
    document.captureEvents(Event.CLICK)
    document.onclick = checkNSClick
    }
    else
    document.onclick = checkIEClick
    &lt;/SCRIPT&gt;
    [/code]

    A little slick redirection:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    &lt;META HTTP-EQUIV="Refresh" CONTENT="1; <A HREF="http://www.insideDHTML.com/home.asp"&gt;" TARGET=_blank>http://www.insideDHTML.com/home.asp"&gt;</A>
    &lt;SCRIPT&gt;
    &lt;!--
    var version = parseInt(navigator.appVersion)
    // replace is supported
    if (version&gt;=4 | | window.location.replace)
    window.location.replace("newPage.htm")
    else
    window.location.href = "newPage.htm"
    // --&gt;
    &lt;/SCRIPT&gt;
    The document, &lt;A HREF="newPage.htm"&gt;Scott's Home&lt;/A&gt; has moved.
    [/code]

    The above code was found at Site Experts. I hope it is useful.

    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Magazine - MetaQuark Creations (Coming Soon)
    sitepoint@digitalmagician.com

    [This message has been edited by wluke (edited August 03, 2000).]

  13. #13
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Before wasting your time, you should be aware that the above code only replaces the current document with the new document to be loaded by a link. It does not affect the rest of the browser history. There is no way to remove pages that were present in the browser history before the current page was loaded.

    In effect, you can only use the above code to prevent people from reaching other pages on your site using the back button, and you cannot use this method to perform form submissions.

    -Kev.

    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

    [This message has been edited by kyank (edited August 03, 2000).]

  14. #14
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wluke,

    you're the bomb.


    FYI - we're using silverstream (application server) as our development environment and it writes it's own javascript.

    thanks!

    Sam

  15. #15
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I keep on getting a close confirmation box when my script closes the window...please help! (NE4.5)

    sam

  16. #16
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Don't tell him &lt;grin&gt;
    In terms of usability it is the pits!

    ------------------
    www.gib-online.com
    The Rock of Gibraltar on the WEB
    www.urban-studios.com
    ...for all your IT solutions

  17. #17
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why does everyone hate me? i'm just trying to figure this out. i'm using it at work for a test that everyone has to take and it's not working.



    so how do i get this confirmation out of the way?


    sam


    c'mon i'm a cool guy!


Bookmarks

Posting Permissions

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