Chrome doesnt read my code

  • So im making a project for school and i need to put couple of pictures in notepad++, im sure that my code is right or the page just would show my picture but when i press run in chrome the page opent in chrome but it doesnt open pictures or a little logo that it cant load a picture it just shows me my code how i wrote it in notepad++. Help i need to finish this fast!!

  • @Nikola-Novakovic ,

    You have technically asked a “cookie baking” question. Just because “i wrote it in notepad++” doesn’t mean that your problem has anything to do with the editor. In this case, you have described the burnt crust of your cookies well enough that I can diagnose your oven temperature was too high: specifically, your file does not end in “.html”, so chrome is treating it as raw text, rather than as HTML source code.

    My guess is that you thought you named your file my.html, but that it actually got named my.html.txt, because the Windows-standard dialog box that you were using auto-added .txt instead of the .html that you thought.

    The problem boils(*) down to Windows settings and possibly a checkbox in the Notepad++ settings. (*: “now we’re boiling cookies? Peter, you’re confusing.” Blame it on the Bard, who took arms against a sea of troubles; mixed metaphors are fun)

    1. In Windows, you need to tell Explorer to always show file extensions. Windows Explorer > View > Options > Change Folder and Search Settings > View and uncheck Hide extensions for known file types. (That’s Windows 10. Other Windows may phrase it differently, but the essence is still the same.) With that checkbox enabled, Windows thinks it knows better than you, and that somehow hiding extensions is a good thing (with the justification that they show an icon, so you’ll know what file type it is even though you can’t see the extension). This doesn’t just affect Windows Explorer: it also affect the common Windows file-open and file-save dialog boxes. But this setting probably made it less obvious to you that your file didn’t have the .html extension, even if you thought it did.
    1. In Notepad++, Settings > Preferences > Default Directory has a checkbox ☑ Use new style dialog (without file extension feature & Unix style path capacity). If that checkbox is disabled, check the box! With it checked, Notepad++ uses the new-style variant of the standard Windows dialog box that doesn’t automatically apply an extension for you. With it unchecked, Notepad++ uses the old-style variant of the standard Windows dialog box that does automatically apply an extension for you… but not necessarily the one you think or want. (If you happen to be using the old-style, and try to select, say, “C source code”, it might pick .h rather than .c, because that happens to be first in the list of c-source-code extensions it was given at some point; that’s pure insanity!)

      note that I keep emphasizing that it’s a windows-standard dialog box. It’s not Notepad++'s fault, or anything that Notepad++ can change. Notepad++ gives you the option to use the old-style, but the bugs quirks of the old-style aren’t Notepad++'s fault. Both versions of the dialog box are Microsoft code which Notepad++ cannot change. Notepad++ gave that option because 5-7 years ago, when the “new style” dialog was introduced, some users would have complained “hey, you changed my dialog box; change is evil”, so Don gave NPP users the choice to continue using the old-and-evil or to update into the modern era with the new Windows standard dialog box.

    Combine these two issues, and the Windows-standard dialog will auto-apply .txt to the name of the file, without you seeing it, because the dialog happened to default to “plain text” rather than “html”, and Windows thought it would be a fun idea to hide part of the filename from you. Cool, huh?

    Save yourself those problems. Have Windows always show extensions, and have Notepad++ use the new-style Windows dialog box.

Log in to reply