Hi all,

I created a blank or empty html file, is there a way the <html> and <head> tags cannot be detected by firebug(note: in view source, it is empty)?

Dani AI

Generated

Short answer: no — developer tools (Firebug/Inspector) show the browser’s parsed DOM, not the raw bytes the server returned. Browsers automatically create implied elements, so an empty file or plain-text response will still appear inside an <html> with a <head> and <body> in the inspector. “View source” shows the raw response; the inspector shows the live, normalized DOM the browser built from that response.

For example, a file whose literal contents are just:

Hello world

will be shown in the inspector as if it were wrapped in an HTML document (the browser inserts the missing tags). That’s normal behavior and cannot be prevented from the client side.

If the intent is to prevent directory listings or hide files on the server, an empty index.html is a valid approach, or disable indexing at the webserver level (Apache example):

# put in .htaccess
Options -Indexes

If the intent is to keep data private, the only real solution is to avoid sending it to the client — enforce authentication/authorization on the server, return 401/403 for unauthorized requests, or render sensitive content only after server-side checks. Techniques that try to “hide” HTML in JavaScript or encode it (base64, obfuscation) are not security — the browser still receives and can display the content, and DevTools can inspect it.

As implied, hiding these tags isn’t useful; as noted, omitting tags won’t stop the browser from creating them. ’s blank file will therefore always show a parsed <html>/<head>/<body> in Firebug/Inspector.

Recommended Answers

All 2 Replies

No. What would be the point?

Try not having the html tags and the head tags! Browsers are amazingly versatile, and display more than just html.

Plain text can be shown also.

But WHY???
What's the point of your blank file? If it's index.htm and intended to prevent people knowing what is in a folder's file listing, okay. But what other reason would you make a blank html file for?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.