Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    May 2012
    Posts
    18
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Problems with links

    Hello everyone,

    First off thanks for taking a moment to help me out here.

    I'm currently building a webpage using html5 and javascript and i'm fairly new to this.

    I'm using a "sliding website plugin" to navigate different section of my website on a single page.
    The URL's are then displayed like this : "../Website/en/index.html#/home", "../Website/en/index.html#/casestudy" etc..

    As you can see it's included inside an /en/ folder.
    I would like people to be able to change from english to french but to stay on the same "page" (ie : en/index.html#/casestudy to fr/index.html#/casestudy)

    Currently for accessing the translated page my code is :
    Code:
    <li><a href="../fr/index.html" title="francais">Français</a></li>
    but it will link to "../Website/fr/index.html#/home" no matter what page the user was on. I do not want them to be sent back to the home page.

    Is there anyway I can achieve this with html or javascript?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Can we have a link to your site.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    946
    Thanks
    0
    Thanked 129 Times in 128 Posts
    ../fr/index.html is a relative url, thus it will point to a page that are located relative to the current page.

    ../ means go up 1 directory
    fr/ means go to subfolder fr.
    index.html means open index.html

    The cuurent document is loated inside ../website/en/
    ../ leads to the parent folder
    ../website/
    fr/ leads to subfolder fr/
    ../website/fr/
    index.html opens this file inside that folder.
    ../website/fr/index.html

    if you then want it to lead to any hash within that page, then you must specify it in the url too.
    <a href="../fr/index.html#/casestudy">

  • #4
    New Coder
    Join Date
    May 2012
    Posts
    18
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Unfortunately that wouldn't work since the content of the webpage is dynamically generated and all the links are pointing to a relative path .. therefore i can't specify in my header the "#/casestudy" or anything else since I don't know where my user is.

    Anyway thanks for the help! I'll just send them back to index.html


  •  

    Posting Permissions

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