I have got the following PHP code:
echo "<input type='image' src='myImage.png' onClick='javascript:location.href = \"index.php?p=1©=true\"' />";
If I click on the image, Chrome redirects to index.php?p=1©=true
. But if I click on the image in Internet Explorer 11, it redirects to index.php?p=1©=true
.
Internet Explorer seems to replace HTML entities in URLs.
I tried using &
instead of &
, but I got the same problem: IE replaces it into the copyright symbol.
How can I use ©
in my URL?
I know that one possible solution would be to replace ©
with &whatever
, but than I must change my hole system.
There are also other people with the same problem:
https://gist.github.com/pguillory/5136408
The correct version is with the &
. Sadly, though, IE11 does indeed have a Big Old Bug in it causing it to take &copy
and turn it into the copyright symbol.
I found a workaround: Percent-encode the c
in copy
:
echo "<input type='image' src='myImage.png' onClick='location.href = \"index.php?p=1&%63opy=true\"' />";
// --------------------------------------------------------------------------------------^^^
Example of the correct version that nevertheless fails on IE11: http://jsbin.com/dajihiwiwo/
Example of the above (which is also correct, just more obtuse) which works on IE11: http://jsbin.com/nehuxazeka/
Why not just swap the variables?
Instead of index.php?p=1©=true
it should still work with index.php?copy=true&p=1
.
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