python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.44k stars 587 forks source link

Redirecting to a different page in different folder #407

Closed Majiedo closed 3 years ago

Majiedo commented 3 years ago

Describe the problem hey i have two folders inside file call " Pages " first folder call WelcomePage which have html file and css and the different page call MainPage which have the same html file and css so i was trying to redirecting from WelcomePage folder into MainPage it says " Error: 404 Not Found Sorry, the requested URL 'http://localhost:8000/Pages/MainPage/index.html' caused an error: File does not exist. " i tried on live server extension it worked prefectily is this kinda bug or what? thank you!

import eel
import eel
eel.init('Pages/WelcomePage')

eel.start('index.html')

...
<html>
   <button onclick="window.location.href = '../MainPage/index.html'>SecondPage</button>
</html>

second html

<html>
<p> hello world </p>
</html>
samuelhwilliams commented 3 years ago

You've told Eel that the root path for your HTML files is Pages/WelcomePage, so I don't think it likes you navigating up beyond that directory.

If you change it to the following it should be OK:

eel.init('Pages')

eel.start('WelcomePage/index.html')
Majiedo commented 3 years ago

Yeah it worked thank you! @samuelhwilliams