0

An Iframe opens from "Sharepoint Site" and "Java Web application" opens in taht iframe which contains a tag having reference to link in same domain using IE9, 10, 11.

Sharepoint Homepage is: http://chera.dmkak-test.de/dashboard/mywork/page/default.aspx

When we click on link we get dialog, Stay on page, leave the page always

<a href="http://chera.dmkak-test.de/_tti_bin/Chumal/Filereader.svc/GetDocument/id/414439/filename/gulaa.pdf" class="fileDownload">Download Gulaa</a>

$(document).on("click", "a.fileDownload", function () {
    var link = $(this).prop('href');
    //console.log("File Download Global" + link);
    $.fileDownload(link);
    return false; //Critical to stop the click event which will trigger a normal file download
      //This is at last of page
});

http://chera.dmkak-test.de/_tti_bin/Chumal/Filereader.svc/GetDocument/id/414439/filename/gulaa.pdf"

Note: This link gets download fine in Firefox and Chrome.


Also, In one of page in IE, link download working fine using same code. That downloadable links are:

Link: http://chera.dmkak-test.de/dashboard/document/downloaddocument/mydownloadabledocument.docx

Link: http://chera.dmkak-test.de/_tti_bin/Chumal/Filereader.svc/GetDocument/id/414439/filename/Mulaa.pdf

Could anyone notice the why this is happening that one link is working but one link is not working.

Iframe in which Java page have following code:

<iframe src="/java/frontpage/activity/925405.do" name="1494844568901" class="cboxIframe" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" frameborder="0"></iframe>
treyBake
  • 6,440
  • 6
  • 26
  • 57
fatherazrael
  • 5,511
  • 16
  • 71
  • 155

1 Answers1

0

For “Stay on Page”/ “Leave the Page” Dialog scenario comes where you are trying to submit page or redirect to another page (or you just re-render the page).

So you have to make sure for that scenario.

or you can try to open iframe window in new window if that can solve your pop up issue.

Asav Vora
  • 61
  • 6
  • It is not re-rendering because it is simple link click as mentioned in description. It is not redirection to another page but simple downloading a file from a href tag. Iframe is already there which when clicked gives pop up. – fatherazrael May 16 '17 at 02:40
  • than its surely header is missing. for your more understanding you can refer [this link](http://stackoverflow.com/questions/16144820/javascript-opening-hidden-iframe-for-file-download-on-document-ready) You just have to set `MIME type` with the `octa-stream` for download. – Asav Vora May 16 '17 at 05:03
  • This link is generated on Web Service Server which returns 'JSON'; which contains this link inside JSON. This link is just put dynamically to Web Page in iframe. – fatherazrael May 16 '17 at 05:57
  • sorry for the confusion, but if you are using anchor tag than use `download` attribute and if you are using iframe than use `target="_balnk"` to avoid this popup.(i guess) – Asav Vora May 16 '17 at 08:27
  • Thanks. You are correct regarding target blank, but it was used before in solution and customer ask to remove it, as users have some required plugins installed in their browser which gives problem in sudden opening and closing of tab behavior. Download attribute not working as expected as i have already tried the same. – fatherazrael May 16 '17 at 10:03
  • did you try hidden iframe for download file? [Example](https://www.codeproject.com/Questions/470316/how-to-download-attachment-using-Iframe) and [another Example](http://csnipp.com/s/737/-Download-file-using-javascript) – Asav Vora May 18 '17 at 05:15
  • Yes. This didn't work. It gives either same error or do not download at all. – fatherazrael May 18 '17 at 05:20
  • than i think you should try [this one also](http://stackoverflow.com/questions/16799483/using-jquery-and-iframe-to-download-a-file). In that please prefer comments of answered question. Bottom Line is to you have to move your code JS to backend side to page with all required headers for download and that's it. I hope it will helps you. – Asav Vora May 18 '17 at 05:27
  • I have already most of this and not worked as expected; but here some new parameters are there in your link. Let me try. Thanks. – fatherazrael May 18 '17 at 05:43