Search code examples
javascriptdownloadeel

Eel application: download files in Browser


i´m currently using JavaScript and HTML with eel and Python. But unfortunately when I am trying to create a file in the Chrome-Browser window (as an download) over JS i can only download it once. The second "download" is not working.

-> Chrome just shows this (as it does when it downloads something) but then nothing happens: enter image description here

When I am using Edge browser or only JS without eel it works perfectly fine!

My JS function that creates the download: (string is a json string that is generated earlier).

  var jsonLink = document.getElementById("jsonLink");
  jsonLink.download = "exportedToJson.json";
  jsonLink.href = "data:application/json;charset=utf-8," + encodeURIComponent(string);

Solution

  • Ok I found a solution:

    My chrome browser was blocking more than one download from "localhost:8000". So I had to go to settings and allow more than one download.

    Maybe this helps someone :)

    Why did I not find this earlier: When I started my Python script, it calls:

    eel.start('index.html', mode='chrome', port=8000) #starting chrome
    

    Which does open a new Chrome Tab without the Tabbar (so i did neither see the tabs nor my favorite sites). Therefore I did not get a notification when chrome stated that download is blocked. But after starting the eel-local webserver and open localhost:8000 in my normal chrome window, I did get a notification and I was able to allow the downloads. -> afterwards it also worked in this eel-chrome window.