Script request: Rewrite all links
|
|
Can some body please write this script for me , i tryed but it kept on bombing out... the script should do the following... if the format is .gif,.mp3.php.html.png.jpg etc ... the script mus add ?vaultx.co.za at the end eg:
2: if the site has sum excess coding
... Thanx to anyone who helps me :) |
|
|
Something like this should work:
You may also want to try this using |
|
|
Thanx bro i will try it and get back tp you..:) |
|
|
This script only rewrite links in the adress bar i need it to rewrite all the links on the page :) |
|
|
Just modifying Gabe's code here. Javascript has built-in arrays for various objects. I believe links are one of them, so you should be able to loop through all the links on any given page and modify them... [the code I initially posted here was all wrong, refer below] |
|
|
The code below should do exactly what you requested in your post, although it seems kind of odd to me that you want to append ?vaultx.co.ca to the end of a URL. That's not a correct querystring. You have the right idea with the &sd= for appending to a preexisting string. Perhaps you meant you want to append ?sd=vaultx.co.ca ... if that is what you intended, you can modify my code below to say "?sd=" rather than just "?" on line 15.
|
|
|
Also, be sure to modify the line that specifies the file extensions you want to apply it to. This is easy if there aren't many. But, if you like, I can modify the code so that there's a single variable at the top that you can modify to simply list out all the extensions you want (for example: var exts = "php,gif,png,foo";) But of course, that will require a bit more code under the hood. |
|
|
Ok, so I decided to do it for you anyway even though you didn't ask. It's below, but I still didn't make any modifications to what you wanted appended (the whole "?" versus "?sd=" thing I mentioned above.
|
|
|
Thanx man i will try it now giev me 5min :) |
|
|
thanks it rights the links jus the css styles and images still dnt get rewritten/// |
|
|
and yes i did all the extensions to that list you gave me.. |
|
|
Perhaps I'm not understanding what you want it to do exactly. The way I understood it was that you want it to rewrite all the hyperlinks on a given page. Is that not correct? Or did you also want to append that string to any URL contained within the source code of the document? (ie., CSS includes, javascript includes, img source elements, etc.) Please try to clarify exactly what you were looking for. |
|
|
i Need to append it to everythng in the soucre eg..css,images etc.. |
|
|
So what you're saying is you want it to attach to the end of any URL that appears anywhere in the document no matter what it points at or what sort of object it's a part of? Is that correct? I'm really curious as to what the ultimate goal of this is? |
|
|
wana use it as a admin mod on my site will change vaultx.co.za to sumthn else ..i want it to work on my site only..il show you wat i wana do with it...can you do it fo me please.. |
|
|
I'll try to get to it sometime this weekend -- sorry, it's been a busy couple of days for me. |
|
|
its ok man ou can do it wen ever you can :) |
