Can I Use A 301 Redirect For Included External Javascript Files?
Solution 1:
When a browser loads the script from the src attribute, it should follow all redirection links, in the same method it retrieves html, images, stylesheets, etc. So the use case you've provided should work.
But since it's not working for you, you have got a couple options to resolve your problem.
Use fiddler or a similar debugging proxy to see what's going on between your browser and the server. Perhaps the 301 is malformed, or perhaps the mime-type is misconfigured, it could be any number of things. Troubleshoot it the same way you'd troubleshoot any other issue where the browser isn't following redirects.
Or... instead of using redirects, you can use mod_rewrite
(or a similar server-side URL rewriting tool) to modify the request for a particular version of a script to your canonical version.
Post a Comment for "Can I Use A 301 Redirect For Included External Javascript Files?"