I have image folder names in caps. But the src
is in lowercase, so this is not loading images.
I can't make all the image folders lowercase, so I want to change my code to take a case insensitive path.
I have a link like this:
<a href="http://www.google.com">
<img id="productMainImage" src="images/Tulips.jpg" alt="image" escapeXml="false" class="product_main_image"/>
</a>
I want to make the image src as case insensitive; meaning I want my
code to work even if src ="IMAGES/Tulips.jpg"
.
How to resolve this issue?
HTML src urls are case sensitive.
Actually only the interpretion of node names in filesystems is case insensitive on MS-Windows systems. Some other things are case sensitive. MS-Windows is not exactly consequent in this.
Generally, HTML is case-insensitive, but there are a few exceptions. Entity names (the things that follow ampersands) are case-senstive, but many browsers will accept many of them entirely in uppercase or entirely in lowercase; a few must be cased in particular ways. For example, Ç is Ç and ç is ç.
Attribute names for HTML elements must exactly match the names of the attributes given in the HTML elements section of this document; that is, attribute names are case-sensitive.
Either you can use JS to do this using toLowerCase()
, or you need to rename them by yourself.
Also, it depends on the server, and HTML has nothing to do with this, UNIX Servers are case sensitive, whereas Microsoft servers are case insensitive.
Also if you are using any server side language, like PHP, you can use strtolower()
as well which would be even better, as client can have JavaScript turned off in which, your page will fail to render images.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With