Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
 
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
W508 - Web and Intranet - Which Browser?
  [2135] What features does this visitors browser support? (PHP) - (2009-04-22)
  [1519] Flipping images on your web page - (2008-01-26)

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


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., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/3128_How ... self-.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat