Hi Guys,
Alright! so you are in same boat that I was until I did a little trick to get around this problem.
Need for using windows.status arises when you don’t want user to see
- You affiliate links
- Your advertisement links
- Simplified URL
- hide status bar onmouseover
- Custom message etc etc
This stuff use to be so simple in old days when we can reliably use window.status=”whatever” so with old technique we can do something like this if I want to hide say my tracking code then I will do something like this
<a href="http://jaspreetchahal.org?tracker=mytracker;" onMouseOver="window.status='http://www.jaspreetchahal.org"; return true" onMouseOut="window.status="">Click here to visit jaspreetchahal.org</a>
As you may already know that because of security reason this window.status does not work the way we wanted to unless you adjust your browser security settings. The text below is taken from w3schools
Note: The status property does not work in the default configuration of IE, Firefox, Chrome, or Safari. To allow scripts to change the text of the status, the user must set the dom.disable_window_status_change preference to false in the about:config screen. (or in Firefox: “Tools – Options – Content -Enable JavaScript / Advanced – Allow scripts to change status bar text”).
Now lets do a little trick using jquery
add this jquery function to a global javascript file that is accessible across your website
function hrefTrap(id) { document.location=$("#"+id).attr('newlink'); return false; }
Now that we’ve a working function to trap our link click I did this to change my hyper link
<a id="trapclick" onclick="return hrefTrap('trapclick')" href="http://jaspreetchahal.org" newlink="http://jaspreetchahal.org?tracker=1234″>Click here to visit jaspreetchahal.org</a>
Alright so the above technique works on all browsers with javascript enabled. Now lets answer what if javascript is disabled?
I am sure that you’ve heard noscript tag in HTML
Well yeah, you are thinking right. Below is to get around if javascript is disabled.
// to cater for disabled javascript I will do something like this</pre> <noscript> <a href="http://jaspreetchahal.org?tracker=mytracker;" >Click here to visit jaspreetchahal.org</a> </noscript> <script type="text/javascript"> document.write("<a id=\"trapclick\" onclick=\"return hrefTrap('trapclick')\" href=\"http://jaspreetchahal.org\" newlink=\"http://jaspreetchahal.org?tracker=1234\">Click here to visit jaspreetchahal.org</a>"); </script>
I hope this helps.
Please leave your comments if you can improve the above code. I know it can be improve to generalize all links on the page but I’ll it to you to work on that.
Cheers





JC WordPress Coupon Revealer Plugin Pro License
Australian Street Names with City, State and Display Names only, Single Server License
“global javascript file that is accessible across your website”
You assume that everyone knows this, but for us dummies, can you please explain?
Thanks much!
sorry about bad wording I guess.
Anyways what I meant was to have an external javascript file that you can put your common JS functions in and include it in (every page)/(layout file) of your website so that every page will have access to your utility functions.