Hi guys,
I m trying a simple script for greasemonkey/firefox and I have some problem with & (ampersand)
As you can see I am trying to cut the part of the url after the &
For Example a link like this:
I want to do it like this:
The code works for all the characters/strings I tried includin the question mark, but It doesn;t work as it for &.
So far I tried some alternatives
var indexOff = linkString.indexOf("&");
var indexOff = linkString.indexOf(%26);
var indexOff = linkString.indexOf("&");
etc..
but with no luck :-(
What is the correct syntax for this?
TIA
I m trying a simple script for greasemonkey/firefox and I have some problem with & (ampersand)
Code:
var links = document.links;
for (var i = 0; i < links.length; i++) {
var link = links[i];
var linkString = link.toString();
var indexOff = linkString.indexOf('&');
if (indexOf > 0) {
link.href = linkString.substring(0, indexOff);
}
}
As you can see I am trying to cut the part of the url after the &
For Example a link like this:
I want to do it like this:
The code works for all the characters/strings I tried includin the question mark, but It doesn;t work as it for &.
So far I tried some alternatives
var indexOff = linkString.indexOf("&");
var indexOff = linkString.indexOf(%26);
var indexOff = linkString.indexOf("&");
etc..
but with no luck :-(
What is the correct syntax for this?
TIA