PDF download does not work on Android Captive Portal Browser

362 Views Asked by At

I have a captive portal set up on my RaspberryPi device which runs a Python/Pyramid based project. When you connect to device's hotspot it gives a notification and when you click on that notification it takes you to the defined(default) page where I have multiple links which let you download PDF files etc.

It works just fine when you are using Chrome Browser or Mozilla or any other browser except for the one which takes you to the defined(default) page when you click on that notification. I think it is a default android browser but I am not sure about it.

Here is sneak peek from my html page

<button class="btn btn-sm pdflink pdfdownload" href="${pdfurl}">
    <i class="fa fa-file-pdf-o" aria-hidden="true"></i>
</button>

$(document).ready(function(){
    $(".pdfdownload").click(function() {
        var url = $(this).attr('href');
        window.location = url;
    });
});

And from Pyramid's download view:

@view_config(context=Product, name="download")
def pdfdownload(context,request):
    blb = context.blobdata
    resp=Response("Unable to fetch the attachment")        
    if blb:
        resp=Response(content_disposition="attachment; filename="+blb.filename.encode('utf-8'),content_type=blb.contentType)
        resp.app_iter = FileIter(blb.retFile(),block_size=4096 * 64)
        resp.content_length = blb.size
    return resp

It doesn't work on Android Captive Portal Browser rest everywhere it works fine.

0

There are 0 best solutions below