Navigator: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Created page with "NSB/App Studio programs run within a special version of a web browser. As a result, they can inherit a lot of the properties of the environment they run in. You can access t...")
 
No edit summary
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
NSB/App Studio programs run within a special version of a web browser.  
AppStudio programs run within a special version of a web browser.  
As a result, they can inherit a lot of the properties of the environment they run in.  
As a result, they can inherit a lot of the properties of the environment they run in.  
You can access these properties from within your app.
You can access these properties from within your app.
Line 5: Line 5:
It is not a complete list: there are additional items in the full HTML documentation. In addition, some browsers may have additional members not shown here.
It is not a complete list: there are additional items in the full HTML documentation. In addition, some browsers may have additional members not shown here.


'''window object members'''
'''Navigator Object Members'''


{| class="wikitable"
{| class="wikitable"
Line 11: Line 11:
|onLine || Returns true or false if the device is currently on line.
|onLine || Returns true or false if the device is currently on line.
|-
|-
|standalone || Returns whether the app is running standalone or within a browser. If standalone, there is no browser menu bar at the top.
|standalone || Returns whether the app is running standalone or within a browser. If standalone, there is no browser menu bar at the top. iOS only.
|-
|-
|vendor || The vendor string for the browser: i.e., Apple, Google.</td>
|vendor || The vendor string for the browser: i.e., Apple, Google.
|-
|-
|appCodeName || Returns the code name of the browser
|appCodeName || Returns the code name of the browser
Line 20: Line 20:
|-
|-
|appVersion || Returns the version information of the browser
|appVersion || Returns the version information of the browser
|-
|language || Returns the language the browser is using. ie. 'en-GB'
|-
|-
|platform || Returns for which platform the browser is compiled
|platform || Returns for which platform the browser is compiled
|-
|-
|userAgent || Returns the user-agent header sent by the browser to the server. Here is a list of codes for<a href="http://www.zytrax.com/tech/web/mobile_ids.html">various devices</a>.
|userAgent || Returns the user-agent header sent by the browser to the server. Here is a list of codes: http://www.zytrax.com/tech/web/mobile_ids.html.
|-
|vibrate(x) || Vibrate for x milliseconds. Can also be an array for multiple vibrates. Android only.
|-
|-
|app.exitApp() || Exits the app to the Home screen. Android only.
|app.exitApp() || Exits the app to the Home screen. Android only.
|}
|}
 
'''Example'''
<pre>
If InStr(navigator.appVersion,"iPhone OS 7_0") >0 Then
  Print "iOS7"
Else
  Print "not iOS7"
End If
</pre>
[[Category:Language Reference]]
[[Category:Language Reference]]


[[Category:Objects]]
[[Category:Objects]]

Latest revision as of 13:56, 21 June 2015

AppStudio programs run within a special version of a web browser. As a result, they can inherit a lot of the properties of the environment they run in. You can access these properties from within your app.

It is not a complete list: there are additional items in the full HTML documentation. In addition, some browsers may have additional members not shown here.

Navigator Object Members

onLine Returns true or false if the device is currently on line.
standalone Returns whether the app is running standalone or within a browser. If standalone, there is no browser menu bar at the top. iOS only.
vendor The vendor string for the browser: i.e., Apple, Google.
appCodeName Returns the code name of the browser
appName Returns the name of the browser
appVersion Returns the version information of the browser
language Returns the language the browser is using. ie. 'en-GB'
platform Returns for which platform the browser is compiled
userAgent Returns the user-agent header sent by the browser to the server. Here is a list of codes: http://www.zytrax.com/tech/web/mobile_ids.html.
vibrate(x) Vibrate for x milliseconds. Can also be an array for multiple vibrates. Android only.
app.exitApp() Exits the app to the Home screen. Android only.

Example

If InStr(navigator.appVersion,"iPhone OS 7_0") >0 Then 
  Print "iOS7"
Else
  Print "not iOS7"
End If