Skip to content

SureFox iOS Javascript API

Jan 10, 2014 | 42Gears Team

Applies to:
Product SureFox
Platform iOS

 

SureFox iOS now comes with built-in set of Javascript APIs. Embed them in your web application to perform variety of actions such as refreshing the page or resetting SureFox Idle Timer.

In order to use these methods, make changes in your web page by making functions as: window.location = “sfcallback:reload

List of methods available:

Method

Syntax

Description

reload sfcallback:reload Reloads current page
home sfcallback:home Go to Home or Run at startup page
resetSureFoxIdleTimer sfcallback:resetSureFoxIdleTimer Resets the Idle Timer of SureFox
getuuid sfcallback:getuuid:printuuid Get Device Unique ID

Examples:

Reload Current WebPage onClick():

 <html>

<head>

<style type=”text/css”>

 

</<style>

<script type=”text/javascript”>

function refreshNow()

{

window.location = “sfcallback:reload”;

}

</script>

</head>

<body>

<div >

<span style=”width:116px;margin-bottom:10px;”

onclick=”refreshNow()”>Refresh Now</span>

</div>

</body>

</html>

Go to Home Page / Home Screen onClick():

<html>

<head>

<script type=”text/javascript”>

function goHome()

{

window.location = “sfcallback:home”;

}

</script>

</head>

<body>

<div >

<span style=”width:116px;margin-bottom:10px;”

onclick=“goHome()”>Go Home</span>

</div>

</body>

</html>

Reset SureFox IdleTimer: In example, on page load a timer starts which calls “resetSureFoxIdleTimer” after the given time interval. If the SureFox IdleTimeout value is more than the interval, this script will cancel SureFox Idle Timer.

<html>

<head>

<script type=“text/javascript”>

function resetSureFoxIdleTimer()

{

window.location = “sfcallback:resetSureFoxIdleTimer”;

}

var count = 30;

function autoResetIdleTimer(){

setInterval(function(){

if(count==0){

resetSureFoxIdleTimer();

count = 30;

}

count–;

},1000);

}

</script>

</head>

<body onload=“autoResetIdleTimer()”>

</body>

</html>

Get Unique Device ID : Once the function (printuuid) mentioned below gets implemented, we can do anything with the UUID. In our example, we have done an alert. Give any function name (printuuid, printUUID, print1 etc.) however not name the function as “print“ (it will call the print function of the browser).

<html>

<head>

<script type=”text/javascript”>

function getUUID()

{

window.location=”sfcallback:getuuid:print1″;

}

function print1(uuid)

{

alert(uuid);

}

</script>

</head>

<body>

<button onclick=”getUUID()” style=’width:50px;height:50px;’/>

</body>

</html>

For any more details contact us on techsupport@42gears.com

For free trail, click here

Subscribe for our free newsletter

Thank you! you are successfully subscribed.
newsletter

Exclusive News and Updates on Enterprise Mobility!

* I consent to receive newsletters via email from 42Gears and its Affiliates.
Please agree
* I have reviewed and agreed to 42Gears Privacy Policy and Terms of Use prior to subscribing and understand that I may change my preference or unsubscribe at any time.
Please agree
Please verify captcha
Please enter a valid official email