CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   HREF / SRC empty (http://www.codingforums.com/showthread.php?t=281254)

lucasbrito3 11-06-2012 04:14 PM

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

felgall 11-06-2012 08:47 PM

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.

VIPStephan 11-06-2012 09:40 PM

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.

felgall 11-07-2012 01:38 AM

Quote:

Originally Posted by VIPStephan (Post 1289469)
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.


All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.