0

I'm having a font problem backtick in IE; I get the error invalid character.

The line where I get the error is:

document.querySelector('form').action = `create.html?id=${id_u}`;

I try to change the line to try to solve the problem but it doesn't work for me.

document.querySelector('form').action = "create.html?id="+id_u;

Where did I go wrong? Can anyone kindly help me?

a_l_e_x
  • 408
  • 1
  • 6
  • 20
  • IE doesn't support backticks. The JS engine in IE is (mostly) an ES5 engine, you can't use JS of newer versions. – Teemu Feb 17 '22 at 10:33
  • Does this answer your question? [Template literals syntax is not working in IE11](https://stackoverflow.com/questions/40871705/template-literals-syntax-is-not-working-in-ie11) – Ivar Feb 17 '22 at 10:33
  • @Ivar already seen but I have not solved the same – a_l_e_x Feb 17 '22 at 10:35
  • 1
    @Jad-v-a There is no solving it. Either you don't use template literals to support IE. Or you stop supporting IE and use template literals. I'd go with the latter. If you use a tool like Babel, you can use template literals and then transpile it to an older version of JavaScript that will work on IE. – Ivar Feb 17 '22 at 10:38
  • what can i use instead of IE? Which browser would you recommend me? – a_l_e_x Feb 17 '22 at 11:22
  • 1
    Anything that isn't abandoned by their developers. :) I use Google Chrome myself. If you care more about privacy you can use Firefox. If you like to stay on the Windows boat, you can go with Microsoft Edge. – Ivar Feb 17 '22 at 11:58
  • @Ivar The problem with Chrome is that I often have CORS problems for POST or DELETE operations, at the browser level not at the server level. I am desperate for this problem – a_l_e_x Feb 18 '22 at 10:29
  • Then you should fix that problem rather than switching to outdated browsers merely for their lack of this security feature. The "[Same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy)" that CORS allows you to bypass is there to protect you and the users of your site from malicious websites trying to get data of logged in users. See MDN on how it works and how you can solve these issues. https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS – Ivar Feb 18 '22 at 10:44
  • @Ivar I can't find where to solve the problem. Do you know anything about this? – a_l_e_x Feb 18 '22 at 11:53
  • I do, but I'm not interested in tutoring/doing it for you. All the information about CORS is in the link in my previous comment. Stack Overflow also has a bunch of good solutions to specific CORS problems. See https://stackoverflow.com/questions/tagged/cors?tab=Frequent – Ivar Feb 18 '22 at 11:59

0 Answers0