www.webdeveloper.com
Results 1 to 12 of 12

Thread: back to previous domain script

  1. #1
    Join Date
    Jun 2012
    Posts
    13

    back to previous domain script

    I'm new in javascript

    But I always wondered why there is no back to previous domain script
    Often I leave some domain following a link, search through say 10 internal tabs, and want to return to the previous domain

    is the a simple script for doing so?
    would be a great help to create a button 'back to previous domain' on my website pages.

  2. #2
    Join Date
    Mar 2011
    Posts
    1,140
    No. JavaScript does not have access to the browser history, so it can't scan the history to find the last URL from a different domain. Browsers make it pretty easy these days for users to handle this task, anyway. They can right-click on the 'Back' button to see a list of their recent history, or open links in new tabs or windows as they browse the web.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Jun 2012
    Posts
    13

    back to previous domain

    I guessed so.

    I agree that with browser history it is not that difficult

    Am I suggesting something stupid that it seems possible
    to fill a javascript variable with the javacript value 'history.back()
    and then set a variable justenterednewdomain = false
    '
    to prevent changing the first variable, which then stores the
    address of the previous domain?

    Only I didn't succeed in programming this tric.
    Do I miss a simple obstacle?

  4. #4
    Join Date
    Mar 2011
    Posts
    1,140
    You really can't do anything with the broswer history except call the history.back() function. You can't change or access any of the values in the history. You probably don't want to manipulate the history.back() value anyway because it would interfere with the user's navigation through your own website.

    You could check the document.referer property to see if (1) it's a valid URL, and (2) the domain is outside of your own. If the referer is a valid, outside domain, you could save that value in a cookie, and use that URL to create a clickable link for your users.
    Rick Trethewey
    Rainbo Design

  5. #5
    Join Date
    Jun 2012
    Posts
    13

    previous domain

    Thanks Rick

    I'll have a look at 'document referrer'.
    I never before stored info in a cookie, out of misplaced fear that cookies are temporary things. This is a fine reason to 'dive into' use of cookies

    I visited your website. Looks great

    Henk Tuten

  6. #6
    Join Date
    Jul 2007
    Posts
    386
    Soooo, you want to rewrite the browser history script/command/button? Why? Just either open new tabs or use the built in method. If the amount of hop backs is still not enough increase it by browser settings (if possible) or if not install an extension/plugin that does the job.

    That is MY OPINION, of course.

  7. #7
    Join Date
    Jun 2012
    Posts
    13
    Hi SparoHawk

    No, I have no intention to rewrite the history.back() button.
    Lots of browsing people while browsing go to a site not by opening a new tab, but by using the same tab again.
    Then after a lot of internal tabs it takes time to return to the entering external domain.
    In the past Firefox used to have a fastforward and fastbackward button for this purpose.

    Experienced browsers like you use browsing history, but for inexperienced users, like most of my readers, a button back to the domain where they came from is quite useful. Instead of x times using the back button.

  8. #8
    Join Date
    Jul 2007
    Posts
    386
    The button is still there. Right click the back or foward buttons. ^^

  9. #9
    Join Date
    Jun 2012
    Posts
    13
    Hi Sparrohawk

    In my wyzo version of FF there is only a back and a forward button.
    I'll have a look at the settings. Anyway this fastbackward or fastforward is not available in IE9 or Chrome.

  10. #10
    Join Date
    Jul 2007
    Posts
    386
    I can do the same on Chrome.

    Internet Explorer (at least version 8) only has a fast backward history.

  11. #11
    Join Date
    Jun 2012
    Posts
    13
    Hi Sparrohawk

    Last reply.
    As far as I know Chrome can jump 3 pages back by rightclicking.
    Am I mistaken?

    IE8 had something similar

    Chrome and IE give 85% of my visitors, and most of them never heard of this rightclick option.
    I'm not interested in what YOU can do (sorry), but in what my visitors are able of doing

  12. #12
    Join Date
    Jul 2007
    Posts
    386
    I never said anything about what they can do. Most users go by using programs without knowing a lot of useful features.

    If you use PHP or other programming language that can handle sessions, you can track their EVERY movement and present them with a jump back history, no need of cookies or browser configuration/options.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles