0

I ran the program, it works for a couple of minutes, and then it gives an error.

Unable to access site.

The localhost site is unable to establish a connection.

ERR_CONNECTION_REFUSED

The error occurs after switching from one html page to another. I tried every solution I could find but nothing worked.

import eel

eel.init('web')
eel.start('main.html', size=(830, 550), mode='chrome', port=8080, host='localhost')

I think that the mistake is that I start to work on one html page, and then move on to another. But at the same time, the program normally works for some time and then it breaks.

<header>
  <nav>
    <ul class="head">
      <li><a href="main.html">Основная</a></li>     
      <li><a href="forDevops.html">Разработчикам</a></li>
      <li><a href="info.html">Теория</a></li>
    </ul>
</header>

This is my header, all pages can open, but after a few minutes eel gives an error message.

If I open the html page in google everything works well. But if I use EEL and open the page as an application it doesn't work.

Let me know if you need any additional information for the code above.

2 Answers2

1

<script type='text/javascript' src="/eel.js"></script>

You must write this code in the head of every page you open in eel. In my case, js is not needed on one of the 3 pages, so I forgot to write down this required code.

eel cannot open your html page if it is not connected

also you need to include some js file. You can even empty, it helped me

0

When you have links, make them relative links (<a href="/app/abc.html">). If you do an absolute link like:

<a href="http://localhost/app/abc.html">

That will fail, because the full URL wants to connect to port 80, and you are servicing port 8080. You COULD do

<a href="http://localhost:8080/app/abc.html">

but it's a heck of a lot easier to use relative URLs.

Tim Roberts
  • 48,973
  • 4
  • 21
  • 30