Results 1 to 4 of 4

Thread: Knowing the url of the browser

  1. #1
    Join Date
    Sep 2008

    Knowing the url of the browser

    Hi there, I would like to know how to get the browser url in order to send the browser to contact page in english or spanish. I write some code is AS3 so I write a Pseudo JS code cause Im tottally lost, I really would like some hints on this one.

    Heres the thing, if you are surfing my site you will be surfing in english or in spanish, like this:


    I would like to shorten the adress till the final "/" backwards,
    I mean, I need to know if the person is surfing in english or spanish, so they can go to their proper language contact form.

    Pseudo code

    function urlLanguage
    url = 'http://www.mysite.com/en/contactus.html'
    url = 'http://www.mysite.com/en/contactus.html'

    window.open ('url', '_self')

    Thanks in advanse for any information about this.

  2. #2
    Join Date
    Sep 2008
    The else line would be:

    url = 'http://www.mysite.com/es/contactenos.html'

    My bad. Greetings.

  3. #3
    Join Date
    Dec 2002
    St. Louis, MO, USA
    Well, it can be done, but it would be a lot of work. What would be better than getting the URL (which can be accessed with document.URL) and looking for either "en" or "es", would be to use a cookie that defaults to one or the other, give the user a link that will switch back and forth between the two, and every time that link is clicked set the value of the cookie to that language.
    o . Q
    ___ "You live and you learn; or you don't live long." - Lazarus Long


  4. #4
    Join Date
    May 2005
    Dirty Jersey
    use "window.location.href" to find the URL

    do something like If(window.location.href.indexOf("siteA") > -1){//send to formA}


    1. If you reply to my post, and your reply would then appear directly beneath my post, DON'T QUOTE MY ENTIRE POST!!! IT'S REDUNTANT!!! IT'S ASININE!!!! IT'S REDUNDANTLY ASININE!!!!! DON'T DO IT!!!!
    2. jQuery extends the functionality of JavaScript. If you don't know JavaScript, give up on that jQuery script and learn JavaScript. You'll save yourself a lot of frustration, I promise.
    3. Use the [code][/code] tags. Otherwise, you may be left wondering why no one responded to your eyesore of a thread.

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