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

193
Visualizações
Pdf Viewer download button not working as expected

I am trying to show pdf in iframe using dynamic form submit, that is working fine we see the pdf properly but now when any user wants to download it via clicking download but it is showing ".htm" file. Also when I do it outside iframe every thing working fine.

<iframe id="report" name="showreport" style="width: 100%;height: 100vh;border: 0;"></iframe>

to dynamically provide pdf to iframe we are creating dynamic form as below:

const mapForm = document.createElement('form');
mapForm.target = "showreport";
mapForm.method = 'POST';
mapForm.action = url;

const mapInput = document.createElement('input');
mapInput.type = 'text';
mapInput.name = 'user';
mapInput.value = 'Admin';

mapForm.appendChild(mapInput);
document.body.appendChild(mapForm);

// Just submit
mapForm.submit();

But when we hit download button it is shows "html" instead of "pdf".

enter image description here

about 4 years ago · Juan Pablo Isaza
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