Page is a not externally linkable
rocknbil - 5:46 pm on Feb 23, 2011 (gmt 0)
There is one more thing you should/could consider.
<li>
<a id="some-unique-id" title="Anti Virus blah blah blah" class="body_con" href="actual_link_to_real_content.html">
Anti Virus</a>
</li>
Your link operates wih Javascript, most likely. But turn it off and what do you have? A link to the page you're already on.
Never overlook the opportunity to feed search engines - which don't execute Javascript - more content, even if that content is just a small page with more links on it. The way you'd do that is by returning false on your link with the Javascript. Like
<script type="text/javascript">
window.onload=function() { attachBehaviors(); };
//
function attacheBehaviors() {
if (document.getElementById('some-unique-id')) {
document.getElementById('some-unique-id').onclick=function() { return get_link(this.href); };
}
}
//
function get_link(url) {
alert('do something with ' + url);
return false;
}
</script>
What does this do?
- attaches the behavior to the link externally (and now you know why I added an ID)
- The return false stops the link form navigating when clicked - if Javascript is enabled.
- If Javascript is not present or disabled, users - and SE's - can still access content via the link.
- You leverage the actual link itself in your get_link function, so you don't have to clog up your code with declared variables or inline stuff (onclick="return get_link('some-url');" )