How can I access and change the attributes of tag, specially the src?
something like this maybe:
document.scripts[i].src
of course it does not work!
I intend to alter it this way:
document.scripts[i].src += '?ver3'
in a loop for all the script on the page.
You could use
document.getElementsByTagName('script')to get all the script elements in the page.However, any script elements that you find will already have loaded their content, so it will be too late to change the URL that they use to load content.
If you want to alter the URLs, you should use a solution on the server side, so that the URLs are changed when they arrive to the browser.