I am currently developing an application where in users can download youtube video.However when I am trying to give a href link , it is streaming the video in another tab rather than popping up save as option in FireFox/Chrome.How should i force the browsers to show download popup?
My Views.py
Dow is a basic function using pafy.
def res(request):
if request.method == "POST":
url = request.POST['ylink']
res = dow(url)
# response['Content-Disposition'] = 'attachment; filename=myfile.m4a'
return render(request,"result.html",{'res':res})
HTML :
<html>
<h1><a href = "{{res}}">Click Here to Download the Video</a></h1>
</html>
I read about content disposition in other questions but all of them are related to HttpResponse which I am not using here. P.S : I am a beginner in Django trying to be a pro! over time