Skip to content Skip to sidebar Skip to footer

Show Name Of The Html File Served By The Web Browser

I want to to be able to display in my Javascript console which home file the browser has loaded when only the domain name has been typed in the browser address bar (e.g. anydomain.

Solution 1:

Is it that this is the server's private business and it doesn't tell the DOM?

Yes.

The client asks for a resource at a given URL. The server responds with that resource.

There is generally no information provided about what process the server used to generate that response. It might have read a file, it might have accessed a database, it might have generated it entirely from inside the software of the HTTP server itself, etc.

Solution 2:

You can use php like this:

<?php echo basename($_SERVER['SCRIPT_FILENAME']);?> or

<?phpecho basename($_SERVER['SCRIPT_NAME']);?>

Post a Comment for "Show Name Of The Html File Served By The Web Browser"