Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
How does your browser find out about itself?

• Does this browser accept Cookies?
• Does this browser accept Flash?
• What processor chip type is in the computer hosting this browser?
• Will this browser run Java Applets?
• How wide is my window?

The answer ... if Javascript is enabled, which it usually is these days, is "via Javascript".

Javascript's navigator object contains the answers to four out of the five questions above - there's a source code example [here] and you can run that example [here].

The Window width (and other things about the document that's displayed within the browser) are in the document object; see [here] for the source of an example, and run it [here].

The questions I started with is "What is my IP address", and I've yet to find a full and proper answer to that one.

I can actually find out the IP address that the server sees me arriving from via PHP, looking at the $_SERVER["REMOTE_ADDR"] variable, and writing an AJAX query. But that reports the IP address from the server's perspective, and not the IP address that's being used on our internal network behind our router. In other words, I'm connected to my local network at the moment as "192.168.200.199", but that's rewritten to "82.33.81.79" when I connect out to the Internet. My server reports back 82.33.81.79, but I really want to know in my browser that I'm at 192.168.200.199.

I'm rather afraid that the answer I'm going to come up with is that I can't easily find my local IP address; JavaScript is sandboxed for security reasons, so I'm not going to be able to have it run a local operating system command and return the results, nor am I going to be able to read a file that I leave on the disc of each local machine. Calling up a local server within the page via Javascript seems attractive, but again I find myself facing cross-site scripting issues. It appears that there *are* techniques around - such as JSONP and CORS - which would let my page call up a local server as well as the remote one, but that's a fudge which relies on me someone opening a security hole (see Cross site Scripting, and I think the wise decision would be for me to look for a cleaner work around to meet my original requirement.
(written 2011-01-11, updated 2011-01-12)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
W602 - Web and Intranet - Client Side Technologies
  [411] Javascript examples (some PHP and MySQL too) - (2005-08-13)
  [522] Javascript events - a good example - (2005-12-09)
  [1322] Flash - is it available to your web page? - (2007-08-26)
  [1681] Adding a button to a web page to print the page - (2008-06-18)
  [1749] Using server side and client side programming together - (2008-08-11)
  [1812] Starting Ajax - easy example of browser calling up server data - (2008-09-27)
  [1813] Ajax - going Asyncronous and what it means - (2008-09-28)
  [1814] Javascript/HTML example, dynamic server monitor - (2008-09-28)
  [2390] Dynamic / changing images on your web page - (2009-09-01)
  [2628] An example of an injection attack using Javascript - (2010-02-08)
  [4277] Sending a message to the server and changing text on a page when a button is pressed - (2014-05-23)
  [4310] Problem ... I want to print a series of numbered forms - (2014-10-05)

W508 - Web and Intranet - Which Browser?
  [1519] Flipping images on your web page - (2008-01-26)
  [2135] What features does this visitors browser support? (PHP) - (2009-04-22)


Back to
Burger me!
Previous and next
or
Horse's mouth home
Forward to
Extra courses - C and C++
Some other Articles
Virtual Hosting with Apache http server - an overall scheme, and avoiding common pitfalls
Lua, Tcl, Python; Worldwide training classes
New Computers for delegates to use
Extra courses - C and C++
How does your browser find out about itself?
Burger me!
Car Parking in Melksham - thoughts on the proposed scheme, and wider thoughts too
The family is defunct. Long live the family.
C++ - putting the language elements together into a program
C++ objects - some short, single file demonstrations
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/3128_How ... self-.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb