Reputation: 5282
i'm loocking for a javascript code (if it's possible) to check if an HTML file has been launched/read from a remote host or from a local folder of pc.
..let me explain better with an example:
i've an html file in C:/folder/file.html if i launch it by double-clicking, a js script print "read from local" on the document.
Now, if i host it on a my website, like www.mydomain.org/file.html and open that page, the js script print "read from online"
This would be greatly helpful, thank you for now.
Upvotes: 7
Views: 1672
Reputation: 493
can give you whether the file is local ("file:") or website ("http:")
Which is implemented by window.location
Upvotes: 8