are there any negative implications of sourcing a javascript file that does not actually exist?
Posted
by dreftymac
on Stack Overflow
See other posts from Stack Overflow
or by dreftymac
Published on 2010-05-20T02:53:14Z
Indexed on
2010/05/20
3:00 UTC
Read the original article
Hit count: 317
If you do script src="/path/to/nonexistent/file.js" in an HTML file and call that in a browser, and there are no dependencies or resources anywhere else in the HTML file that expect the file or code therein to actually exist, is there anything inherently bad-practice about doing this?
Yes, it is an odd question. The rationale is the developer is dealing with a CMS that allows custom (self-contained) javascript files to be provided in certain circumstances. The problem is the CMS is not very flexible when it comes to creating conditional includes for javascript. Therefore it is easier to just make references to the self-contained js files regardless of whether they are actually at the specified path.
Since no errors are displayed to the user, should this practice be considered a viable option?
© Stack Overflow or respective owner