I followed a tutorial made by Jerry Hildenbrand, where he teaches how to control a LED via local network.

His tutorial works perfectly, I just need to type tightvncserver in the raspberry and open any browser (even in the mobile) with the raspberry pi ID address and everything works perfectly.

The problem is if I try to open the


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="mobile-web-app-capable" content="yes">
        <meta name="viewport" content = "height = device-height, width = device-width, user-scalable = yes" /> 
        <script type="text/javascript" src="/webiopi.js"></script>
        <script type="text/javascript" src="/js/superled.js"></script>
        <link rel="stylesheet" type="text/css" href="/css/superled.css">
        <link rel="shortcut icon" sizes="10x10" href="/img/LED-icon.png" />
        <div id="content" align="center"></div>
        <p align="center">Push button; turn the led on</p>

The button created in javascript doesn't appear in my browser(like in the browser on right side), even though I can make the background color appear just changing the CSS path (removing the slash)





I don't know why, all the folders and files follow the same structures that is inside the raspberry pi).

enter image description here

enter image description here

  • Have you tried doing the same (removing the leading slash) with the 2 javascript paths? Aug 3, 2017 at 14:14
  • Yes, I did. still not appearing. Aug 3, 2017 at 14:16
  • When I am using the raspberry IP address the page is normal, just when I open the index.html there is the problem. Aug 3, 2017 at 14:23
  • XY problem: why are you trying to locally open the index.html file if requesting it from the RPi's web server works?
    – Hydraxan14
    Aug 3, 2017 at 15:19
  • Because it is easier and faster for edit and test any new alteration a make in the code. Also I am new using html, javascript and raspberry pi, so I am not sure what is the best way to program. Thank you . Aug 3, 2017 at 15:45

1 Answer 1


when you open your website from web server all resources images or js files are relative or absolute to the root web site folder for example <href="/css/superled.css"> mean for the browser the file located in : /Users/.../myhomefolder/mywebsitefolder/css/superled.css, but when you open the file from file system File://Users/.../index.html resources are relative to the root system folder which mean the browser will search file in the current path : /css/superled.css which for sure is not correct. instead opening file from File system open the web server page.

  • Exactly the answer I was expecting. Thank you very much. You very good. Aug 3, 2017 at 21:57
  • 1
    @ThiagoFarias Please accept the answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Feb 1, 2020 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.