SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Is this "back" link semantically OK?

    I am trying to make a "back" link accessible as below:

    HTML Code:
    <noscript>
    <p class="fehler">Attention! Your browser does not support the "back link" function.</p>
    </noscript>
    <p>Please click on this <a href="#" onkeypress="back(); return false;" title="Go back link - Works only if JavaScript is activated in your browser!" tabindex="1"><strong>back-link</strong></a> or use the back-button of your browser to return.</p>
    Is this smantically OK?

  2. #2
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, i'd suggest actually using javascript to write the back link's code, and not to have anything there is js is disabled/unavailable...
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  3. #3
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry but I do not understand what you mean.

  4. #4
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Since it relies on javascript to work you should use javascript to write that code. This way if a user has javascript turned off, or just can't use it anyways, they won't be burdened with a dead link that won't take them back.

  5. #5
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And Redux I just got this from Stymiee:

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function back() {
    history.go(-1);
    }
    document.onkeypress = back;
    //-->
    </SCRIPT>

    <A HREF="#" onclick="back(); return false;">Back</A>

  6. #6
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Quote Originally Posted by stymiee
    Since it relies on javascript to work you should use javascript to write that code. This way if a user has javascript turned off, or just can't use it anyways, they won't be burdened with a dead link that won't take them back.
    Endless of thanks Stymiee for your help. Very appreciated!!!

  7. #7
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <script type="text/javascript">
    document.write('<p>Please click on this <a href="javascript: history.go(-1)" title="Go back to the previous page" tabindex="1"><strong>back-link</strong></a> or use the back-button of your browser to return.</p>');
    </script>
    much more elegant. if javascript is disabled, the paragraph doesn't even appear. also note the change to the link itself: no need for href="#" and onclick...as we already know that javascript is enabled (as otherwise the link itself wouldn't be there), we can use href="javascript:...."

    also, no need for a <noscript> block, as the functionality of going back is still available to users without javascript via the normal browser buttons.

    of course an even more elegant solution would be to use server-side scripting (php or similar) to write out the back link, thus making it usable without javascript and making the whole client-side script unnecessary.

    Edit:

    note that the forum here has added some underscores to the word javascript in my code example...presumably to avoid any code actually executing when viewing the post here
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  8. #8
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Excellent Redux. But what is with Search Engines? That is why I wanted to use external js.

  9. #9
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Redux, it does not validate!

  10. #10
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My apologies Redux. It works and it is just excellent.
    I have implemented on my pages.

    Sorry again.


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
  •