Tiago Mateus
Tiago Mateus

Reputation: 354

javascript multi download pdf ie

I have a problem with multi pdf downloads

I have a list of a and at the href I have links of several pdfs, after that I made a cycle and foreach a that I found I created an iframe, where in the place of the source I insert a value of the href of the a

This works in all browsers except internet explorer.

$('.btns a').each(function(i){

    var source = $(this).attr('href');
    $('#content_iframe').append('<iframe id="someId" src="'+source+'" />');

});

Upvotes: 1

Views: 384

Answers (2)

Tiago Mateus
Tiago Mateus

Reputation: 354

The problem is this:

"Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion."

To solve this I had to create an alternative:

  • if the download don´t start the user has the chance the start the downloads manually.

As I had said I just have this problem with IE..

Upvotes: 1

Ivo Pereira
Ivo Pereira

Reputation: 3500

Iframe doesn't close itself. As modern browsers may be able to parse the iframe tag correctly (trying to correct the code itself), the Internet Explorer does not do it so well.

Instead it should be:

$('.btns a').each(function(i){

    var source = $(this).attr('href');
   $('#content_iframe').append('<iframe class="someClass" src="'+source+'"></iframe');

});

By the way, I've changed your Id to a class, as IDs are unique, therefore you cannot have more than one object with the same ID... btw IE doesn't like that too (aswell as other browsers!).

May I ask you what is your objective with this? It would help a lot when explaining the answer.

Upvotes: 1

Related Questions