My task is, if user clicks download link to download a file, the file should be automatically downloaded. I done this task and got successful output in browsers chrome and IE.Now my problem is, my code is not working for browsers mozilla firefox and safari. Please help me to solve this 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)
for 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 is 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 this HTML tag:
<a href="link/to/file" download>Download link</a>