OS Detection - How to use it
Posted: Fri Jun 28, 2013 12:23 am
I noticed that you include a JavaScript file that contains code for getting the browser name and the operating system name from the web client (web browser) that is currently displaying the documentation that I created with oXygen.
This is the fully-qualified path name of the JavaScript file that I'm talking about:
I was curious to see if this information was actually available, so I opened my compiled web doc set in Internet Explorer, and then I performed the following steps:
The BrowserDetect object was the third item in the list.
So this is great! It means my web docs "know" which web browser they're currently being displayed in, and which operation system that browser is currently running on!
So Here's My Question...
The mobile version of the web docs I'm authoring, apply to both the iPhone and to Android-based devices. If I tag my content appropriately, can I use
and
to have my docs selectively render content that specifically targets each of these platforms (iOS and Android)?
Thanks,
Chris.
This is the fully-qualified path name of the JavaScript file that I'm talking about:
Code: Select all
C:\Program Files\Oxygen XML Editor 15\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\oxygen-webhelp\resources\js\browserDetect.js
- I open the Developer Tools (by pressing F12),
- Clicked the Script tab,
- Selected the Watch pane,
- Clicked inside the Watch pane, and added the variable this.
- Then I clicked the little plus sign beside this, to expand it so I could see all of the property variables for the current session.
The BrowserDetect object was the third item in the list.
So this is great! It means my web docs "know" which web browser they're currently being displayed in, and which operation system that browser is currently running on!
Code: Select all
this.BrowserDetect.versionSearchString="Windows"
this.BrowserDetect.browser="Explorer"
this.BrowserDetect.version=10
this.BrowserDetect.OS="Windows"
The mobile version of the web docs I'm authoring, apply to both the iPhone and to Android-based devices. If I tag my content appropriately, can I use
Code: Select all
this.BrowserDetect.OS="iOS"
Code: Select all
this.BrowserDetect.OS="Android"
Thanks,
Chris.