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 to the CF scene
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HREF / SRC empty

    I was trying to run a validation software within our company's website that was developed using coldfusion.

    The website renders perfectly but it fails verification. This is the following error i get.



    This link is broken. The SRC or HREF is an empty string

    HREF=”” or SRC=”” can cause unexpected effects such as traffic spikes or cookie corruption.



    The code affected is:



    <a href="" onClick="window.open('#to_root#debug_mode.cfm?height=400,width=500,scrollbars=yes');return false;" target="_top" class="globalNavButton">Debug</a>



    I have tried to add a # sign to the href target, but that brought an error to the website and the page would not render.

    Would anyone be able to assist on how to bypass this issue?



    Thank you

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,620
    Thanks
    0
    Thanked 645 Times in 635 Posts
    The value to put in the href is the address of the page that people without JavaScript are supposed to be taken to if they click on the link.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,629
    Thanks
    6
    Thanked 1,002 Times in 975 Posts
    Generally I’m felgall’s opinion that an anchor must work without JavaScript. But sometimes there are cases where we as developers have no choice other than working with what we’ve got. That said, remove the href completely as apparently it serves no purpose anyway. An anchor is valid without href attribute, too.

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,620
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Quote Originally Posted by VIPStephan View Post
    Generally I’m felgall’s opinion that an anchor must work without JavaScript. But sometimes there are cases where we as developers have no choice other than working with what we’ve got. That said, remove the href completely as apparently it serves no purpose anyway. An anchor is valid without href attribute, too.
    Where it isn't intended to work without JavaScript it generally is better to actually add it to the page using JavaScript so that those without JavaScript don't even see it at all.

    Of course if it is for an intranet where everyone is confirmed to have JavaScript then having the tag in the HTML without the href makes sense.


    Another alternative is to make it a <span> tag rather than an <a> tag.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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