jquery issues - it wont change it accordingly
Posted
by
chuck
on Stack Overflow
See other posts from Stack Overflow
or by chuck
Published on 2012-04-13T04:25:27Z
Indexed on
2012/04/13
5:29 UTC
Read the original article
Hit count: 169
My coding isnt linking properly , its meant to use jquery to detect the OS and change the link accordingly , however it isn't. In my HTML page I have it linked in the header as
<script src="jsquery.js" type="text/javascript"></script>
which loads up my jsquery now
$(document).ready(function() {
if (navigator.appVersion.indexOf("Win") != -1) {
// Computers runs windows
$("a[href$='.pdf']").each(function() {
this.href = this.href.replace("Volumes", "KP01DS0194TG");
});
}
if (navigator.appVersion.indexOf("Mac") != -1) {
// computer is a Mac
$("a[href$='.pdf']").each(function() {
this.href = this.href.replace("KP01DS0194TG", "Volumes");
});
}
});
Yet on Mac's it still tries to connect to KP01DS0194TG and not to Volumes - it doesnt change it - how can I get it to recognize the OS and change it accordingly?
© Stack Overflow or respective owner