python - How to download a file from Mozilla Firefox using HTML? -
my task is, if user clicks download link download file, file should automatically downloaded. done task , got successful output in browsers chrome , ie.now problem is, code not working browsers mozilla firefox , safari. please me solve issue.
ff = open('sample.html','a') ms = """<h2>product summary</h2> <center><table border = "1"> <tr> <th>product id</th> <th>product download</th> </tr>""" ff.write(ms) row in __builtin__.product_info: ff.write("<tr>") ff.write("<td> %s</td>" %str(row[0]).strip()) ff.write("<td>") ff.write("<a href= '%s' download>download</a>" %str(row[1]).strip()) #(the problem here..) ff.write("</td>") ff.write("</tr>") m = """</center></table> <br> </pre> </body> </html>""" ff.write(m) ff.close()
you can create download link using html tag:
<a href="link/to/file" download>download link</a>
Comments
Post a Comment