Picture not showing
I am learning basic coding. I am practicing a small exercise where I use notepad to display an image, on a page on Fire Fox. All the exercises have worked but this one. I know I have the correct code, because it works on Google, Edge and Brave browsers. I want to use your browser to learn to code, because of the ease of use. What do you think the issue could be? I looked through your settings and tried everything in the security tab and looked through the other sections and can't figure out what changes I could make to fix it.
All Replies (9)
For sure the local path is wrong.
You can open dev tools (ctrl + shift +i) and examine Console and Network tabs.
I don't know what I am looking for. Why does it work on the other 4 browsers I have?
You didn't provide code, so it's hard to tell. I'd guess those other browsers ignore same origin policy for localhost.
If the image is in the same folder as the HTML file, use a relative link, i.e., just the file name with no path.
If the image is in a different folder, security restrictions often prevent Firefox from loading it from disk.
If you want to use a full path on disk, use a file:/// protocol URL. To get that URL, drop the image into a tab in Firefox and copy the URL from the address bar.
I am trying to learn how to code from the very very basic level. I wanted to use your browser to keep it separate from the other browsers. The lessons build off each other if I can't get this one to work I will have to use the other browsers. The first 6 lessons worked fine. I am going to try to move on and see if it will work on the next lesson, but is there a way to change the security restrictions?
Did you fix the src path to match the one you get when opening the image in its own tab in Firefox?
Assuming so, could you check the Web Console (Ctrl+Shift+K) and see whether it gives an explanation for the problem after that?
You can create a new profile for insecure development work and lift the restriction there. What that means is any locally saved HTML file you open could read any file on your hard drive and potentially forward it or its contents to a web server, so you would only use it for files you wrote yourself and not for files you saved from websites.
New Profile Test
This takes about 3 minutes to set up.
Inside Firefox, type or paste about:profiles in the address bar and press Enter/Return to load it.
Take a quick glance at the page and make a mental note of which Profile has this notation: This is the profile in use and it cannot be deleted. That is your current default profile.
Click the "Create a New Profile" button, then click Next. Assign a name like LocalDev, ignore the option to relocate the profile folder, and click the Finish button.
Firefox will switch your default profile to the new one, so click the Set as Default Profile button for your regular one to avoid an unwanted surprise at your next startup.
Scroll down to LocalDev and click its Launch profile in new browser button.
Firefox should open a new window that looks like a brand new, uncustomized installation. (Your existing Firefox window(s) should not be affected.) Please ignore any tabs enticing you to connect to a Sync account or to activate extensions found on your system to prevent cross-contamination.
I do suggest setting a different theme so you can distinguish this profile's windows from your regular profile. See: Use themes to change the look of Firefox.
When you are done with LocalDev for the time being, you can close the extra window without affecting your regular Firefox profile. In the future, you can use the about:profiles page to launch it when needed.
(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.
More info on about:config: Configuration Editor for Firefox. The moderators would like us to remind you that changes made through this back door aren't fully supported and aren't guaranteed to continue working in the future.
(2) In the search box in the page, type or paste security.fileuri.strict_origin_policy and pause while the list is filtered
(3) Double-click the preference to switch the value from true to false -- understand this makes opening local files insecure
Thanks for the very quick reply. I will try the above later. But now I can't get it to open correctly in any browser. HAHAHAHAHAHAHA, Coding is just not my friend.
There's an error console in other browsers, too. F12 isn't a direct shortcut to the console, but it's the universal shortcut to open the developer tools and then you can click the Console tab. If you're like me, you'll be checking them frequently.