Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
Scripts won't run on internet explorer 11 (ie11)

I have a script below

var dt = new Date();
year  = dt.getFullYear();
month = (dt.getMonth() + 1).toString().padStart(2, "0");
day   = dt.getDate().toString().padStart(2, "0");

document.getElementById("date").innerHTML = year+"."+month+"."+day;

It's a simple script that displays current date (year, month and day).

The problem is that for some reason it won't work on internet explorer 11. (I have javascript enabled). On browsers like mozilla, chrome it works fine. Maybe the script should be differently written just for ie11?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The issue is that you are using .padStart method that is not supported by the IE

You should check can i use before dealing with IE :)

As an option, you can use the polyfill from MDN or from here. And here is EN version for the padStart

In case you have to support IE in production, I would advise you to check transpilers (babel as example) It allows you to use modern code without worrying about old browsers. The downside is that configuration might be a bit tricky. But it really worth it.

about 4 years ago · Juan Pablo Isaza Relatório

0

Internet Explorer 11 is too old to support padStart.

You should have seen an error message about it being undefined when you looked at the developer tools when you debugged your code in IE. You did debug it, didn't you?

It is a legacy browser that Microsoft only provides for the benefit of out-of-date intranet based web applications.

MDN links to a couple of polyfills if you really need to support it in new development. As a rule of thumb, you should be working to eliminate it from your organisation instead.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda