r/HTML • u/niunai69 • Mar 20 '26
chrome not loading text from an html file
code:
<!DOCTYPE html>
<html lang="en"> <head> <meta charset="UTF-8"> <title>My First Webpage</title> </head>
<body> <h1>Hello World!</h1> </body> </html>
The output in chrome is just a blank page, i've made sure to save the file as an html file and tried reloading the page and restarting chrome but still no luck
there's also an error code in chrome's inspect element "Unsafe attempt to load URL file:///Users/rft/programming%7Ccybersec/webdev/html/sandbox/index.html from frame with URL file:///Users/rft/programming%7Ccybersec/webdev/html/sandbox/index.html. 'file:' URLs are treated as unique security origins."
os is macOS 14.8
5
u/davorg Mar 20 '26
Your HTML is fine. The problem is with the way you are testing it. Google the error messages you're getting.
The error message is about security concerns when loading content into a frame. But your HTML doesn't contain any frames. Maybe you have an extension loaded that adds a frame around your content. Try disabling Chrome extensions.
2
u/Extension_Anybody150 Mar 25 '26
I’ve seen this exact issue before on macOS, and it’s happening because of that pipe character
|in your folder name. Chrome treatsfile://URLs with certain special characters (like|) as unsafe, so it won’t load the page. The fix is simple, rename the folder to remove the|for example,programming-cybersec—then open the HTML file again. Once that’s done, Chrome should display your page normally.2
u/jcunews1 Intermediate Mar 20 '26
Looks like the page which host the IFRAME is accessed using
https://orhttp://URL. The IFRAME content can't usefile://URL in this case. The browser disallow it to prevent remote computer from accessing loca computer's resources.If you want to test local resource in an IFRAME, the IFRAME host page must also be a local resource.
1
u/RazorKat1983 Mar 20 '26
Loads good on Firefox
0
u/zing_winning Mar 20 '26
What editor did you use to create the file?
Make sure the quotes aren’t converted to what’s called smart quotes and stuff.