The properties for Browser widget are as follows:
Enables you to control accessibility behavior and alternative text for the widget.
For more information on using accessibility features in your app, refer Accessibility appendix.
Syntax
accessibilityConfig
Type
Object
Read/Write
Read + Write
Remarks
The accessibilityConfig property is enabled for all the widgets which are supported under the Flex Layout.
The accessibilityConfig property is a JavaScript object which can contain the following key-value pairs.
a11yLabel [String]
Optional. Specifies alternate text to identify the widget. Generally the label should be the text that is displayed on the screen.
a11yValue [String]
Optional. Specifies the current state/value associated with the widget so that the user can perform an action. For example, a checkbox is in selected state or unselected state. On the Android platform, the text specified for a11yLabel is prefixed to the a11yValue.
a11yHint [String]
Optional. Specifies the descriptive text that explains the action associated with the widget. On the Android platform, the text specified for a11yValue is prefixed to the a11yHint.
a11yHidden [Boolean]
Optional. Specifies if the widget should be ignored by assistive technology. The default option is set to false. This option is supported on iOS 5.0 and above, Android 4.1 and above, and SPA
Android limitations
SPA/Desktop Web limitations
Example
This example uses the button widget, but the principle remains the same for all widgets that have an accessibilityConfig property.
//This is a generic property that is applicable for various widgets. //Here, we have shown how to use the accessibilityConfig Property for button widget. /*You need to make a corresponding use of the accessibilityConfig property for other applicable widgets.*/ Form1.myButton.accessibilityConfig = { "a11yLabel": "Label", "a11yValue": "Value", "a11yHint": "Hint" };
Platform Availability
This property enables you to play a video inline in a Browser widget .
Syntax
allowsInlineMediaPlayback
Type
Boolean
Read/Write
This property is read-write for UIWebView and read-only for WKWebView (From Visualizer V8 SP4 FP 72 version onwards, Kony Visualizer does not support UIWebView).
Remarks
The default value of this property is false.
When you set the value of this property as true, the video in the Browser does not open on another screen. The video is played on the same screen.
To ensure that this property works for devices with iOS 10 and later, add the playsinline attribute to the video element inside the HTML document. For applications created for OS versions earlier than iOS 10, add the webkit-playsinline attribute to the video element in the HTML document.
Example
Sample HTML document for iOS 10 and later:
<!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> <video width="400" controls playsinline> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> </video> </body> </html>
Sample HTML Document for devices earlier than iOS 10
<!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> <video width="400" controls webkit-playsinline> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> </video> <p> Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>. </p> </body> </html>
frmBrowser.myBrowser.allowsInlineMediaPlayback = true;
Platform Availability
Specifies the anchor point of the widget bounds rectangle using the widget's coordinate space.
Syntax
anchorPoint
Type
JSObject
Read/Write
Read + Write
Remarks
The value for this property is a JavaScript dictionary object with the keys "x" and "y". The values for the "x" and "y" keys are floating-point numbers ranging from 0 to 1. All geometric manipulations to the widget occur about the specified point. For example, applying a rotation transform to a widget with the default anchor point causes the widget to rotate around its center.
The default value for this property is center ( {"x":0.5, "y":0.5} ), that represents the center of the widgets bounds rectangle. The behavior is undefined if the values are outside the range zero (0) to one (1).
Example
Form1.widget1.anchorPoint = { "x": 0.5, "y": 0.5 };
Platform Availability
This property is used to configure the base URL and load a resource file in a Browser widget.
Syntax
baseURL
Type
String
Read/Write
Read + Write
Remarks
The default value for this property is about:blank.
Note: From Visualizer V8 SP4 onwards, you cannot provide an empty string to access the root folder. You must provide the value, "." , to access the root folder. Here is an example of the codefrmBrowser.myBrowser.baseURL = ".";
This property is mandatory for loading a resource file inside a browser widget. The resource file can be an image file, audio file, video file or another HTML file.
Example
//Sample code to access a base URL in Browser widget.
frmBrowser.myBrowser.baseURL="http://www.kony.com";
/*Sample code to access a resource file in a browser widget, when it is packaged in an application.*/
frmBrowser.myBrowser.baseURL = kony.io.FileSystem.getApplicationDirectoryPath();
Platform Availability
This property determines the bottom edge of the widget and is measured from the bottom bounds of the parent container.
The bottom property determines the position of the bottom edge of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. In freeform layout, the distance is measured from the bottom edge of the parent container. In flow-vertical layout, the value is ignored. In flow-horizontal layout, the value is ignored.
The bottom property is used only if the Height property is not provided.
Syntax
bottom
Type
String
Read/Write
Read + Write
Remarks
The property determines the bottom edge of the widget and is measured from the bottom bounds of the parent container.
If the layoutType is set as kony.flex.FLOW_VERTICAL, the bottom property is measured from the top edge of bottom sibling widget. The vertical space between two widgets is measured from bottom of the top sibling widget and the top of the bottom sibling widget.
Example
//Sample code to set the bottom property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.bottom = "50dp"; frmHome.widgetID.bottom = "10%"; frmHome.widgetID.bottom = "10px";
Platform Availability
This property is used to configure the cachePolicy and storagePolicy of the cache responses for the request at the app level.
Syntax
CacheConfig
Type
Dictionary
Read / Write
Read + Write
Input Parameters
Parameter | Description |
---|---|
cacheConfig(JSDictionary) |
The cacheConfig is a dictionary which configures the cachePolicy and storagePolicy of the cache responses. cacheConfig Constants The cache config has the following constantsfor cachePolicy:
The cache config has the following constantsfor storagePolicy:
|
Example
//Sample code to add cacheConfig proerty to the browser widget frmBrowser.myBrowser.cacheConfig = { cachePolicy: kony.net.cache.RELOAD_IGNORING_LOCAL_CACHE_DATA, cacheStoragePolicy: kony.net.cache.MEMORY_ONLY }
Platform Availability
iOS
Specifies whether the scroll view bounces past the edge of the content and back again.
Syntax
bounces
Type
Boolean
The default value for this property is true.
If set to false, the scroll view bounce is not applied.
If set to true, the scroll view bounce is applied.
Example
//Sample code to enable bounces property for a Browser widget. frmBrowser.myBrowser.bounces=true;
Platform Availability
There are two ways to load web pages in iOS applications, UIWebView (deprecated from Visualizer V8 SP4 FP72 version) in UI framework and WKWebView in WK framework. The browserType property helps you to set the type of web view that you want to load the web pages in your application.
Syntax
browserType
Type
Constant
You can set any of the following value to this property.
Read/Write
Read + Write
Remarks
UIWebView has been deprecated by Apple from iOS 12.0 version. As a result, from Visualizer V8 SP4 FP72 version (and v8 SP3 FP68 version )onwards, Quantum Visualizer does not support UIWebView. For more information, click here.
Example
/*Sample code to set the browserType property in myBrowser Browser widget in frmBrowser form.*/
frmBrowser.myBrowser.browserType=constants.BROWSER_TYPE_WKWebView;
Platform Availability
This property determines the center of a widget measured from the left bounds of the parent container.
The centerX property determines the horizontal center of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. In freeform layout, the distance is measured from the left edge of the parent container. In flow-vertical layout, the distance is measured from the left edge of the parent container. In flow-horizontal layout, the distance is measured from the right edge of the previous sibling widget in the hierarchy.
Syntax
centerX
Type
String
Read/Write
Read + Write
Remarks
If the layoutType is set as kony.flex.FLOW_HORIZONTAL, the centerX property is measured from right edge of the left sibling widget.
Example
//Sample code to set the centerX property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.centerX = "50dp"; frmHome.widgetID.centerX = "10%"; frmHome.widgetID.centerX = "10px";
Platform Availability
This property determines the center of a widget measured from the top bounds of the parent container.
The centerY property determines the vertical center of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. In freeform layout, the distance is measured from the top edge of the parent container. In flow-horizontal layout, the distance is measured from the top edge of the parent container. In flow-vertical layout, the distance is measured from the bottom edge of the previous sibling widget in the hierarchy.
Syntax
centerY
Type
String
Read/Write
Read + Write
Remarks
If the layoutType is set as kony.flex.FLOW_VERTICAL, the centerY property is measured from bottom edge of the top sibling widget.
Example
//Sample code to set the centerY property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.centerY = "50dp"; frmHome.widgetID.centerY = "10%"; frmHome.widgetID.centerY = "10px";
Platform Availability
Clears the browser's canvas before data is loaded.
Syntax
clearCanvasBeforeLoading
Type
Boolean
Read/Write
Read+Write
Remarks
If this property is set to true
, the browser widget will clear its canvas before it loads data. If it is false
, it will not clear the canvas.
Example
//Sample code to disable clearCanvasBeforeLoading property in Browser widget.
frmBrowser.myBrowser.clearCanvasBeforeLoading=false;
Platform Availability
In Desktop Web applications, when you hover the mouse over any widget, a pointer appears. Using the cursorType property, you can specify the type of the mouse pointer in Visualizer.
Syntax
cursorType
Type
String.
You must provide a valid CSS cursor values such as wait, grab, help, etc. to the cursorType property.
Read/Write
Read + Write
Example
//This is a generic property and is applicable for many widgets.
/*The example provided is for the Button widget. Make the required changes in the example while using other widgets.*/
frmButton.myButton.cursorType = "wait";
Platform Availability
Specifies if the Browser widget must support the detection of phone numbers in the web page and display the phone numbers as clickable Phone links. If you click the Phone link, the Phone application launches and dials the number.
Syntax
detectTelNumber
Type
Boolean
Read/Write
Read + Write
Remarks
The default value for this property is true.
If set to false, the Browser does not detect the Phone numbers.
If set to true, the Browser detects the phone numbers and displays them as links on the Phone.
On BlackBerry platform (7 and previous), the default value is set based on the device constraints.
Example
//Sample code to enable detectTelNumber property in Browser widget.
frmBrowser.myBrowser.detectTelNumber=true;
Platform Availability
The property enables you to improve the performance of Positional Dimension Animations.
Syntax
enableCache
Type
Boolean
Read/Write
Read + Write
Remarks
The default value for this property is true.
Note: When the property is used, application consumes more memory. The usage of the property enables tradeoff between performance and visual quality of the content. Use the property cautiously.
Example
Form1.widgetID.enableCache = true;
Platform Availability
This property is applicable in Android native platform, when a Browser or a CordovaBrowser widget appears in the middle of mobile device screen. When the user touches the Browser or CordovaBrowser widget, the screen scrolls up, and moves the widget to the top of the screen.
When enableFocusInTouchMode
property is configured to false, the widget will not move to the top of the screen. When configured to true, the widget will move to the top of the screen.
This property is applicable only for Browser and CordovaBrowser widgets.
Syntax
enableFocusInTouchMode
Type
Boolean
Read/Write
Read + Write
Example
//This property is applicable for Browser and CordovaBrowser widgets. /*This example demonstrates how to use enableFocusInTouchMode property by using myBrowser Browser widget in frmBrowser FlexForm. You need to use enableFocusInTouchMode property for CordovaBrowser widget in a similar manner.*/ frmBrowser.myBrowser.enableFocusInTouchMode= false;
Platform Availability
Android
Enables web apps to access Kony native capabilities from within the web app's JavaScript code.
Syntax
enableNativeCommunication
Type
Boolean
Read/Write
Read only
Remarks
By default, this property is set false
. Your app can only set this property in the Browser widget's constructor. After the constructor executes, this property is read-only.
Example
//This property is applicable for Browser and CordovaBrowser widgets. /*This example demonstrates how to use enableNativeCommunication property by using myBrowser Browser widget in frmBrowser FlexForm. You need to use enableNativeCommunication property for CordovaBrowser widget in a similar manner.*/
FrmBrowser.myBrowser.enableNativeCommunication = true;
Platform Availability
Specifies whether the browser should load pages in overview mode. For example, zoom out the content to fit in the screen width.
Syntax
enableOverviewMode
Type
Boolean
Read/Write
Write only
Remarks
The default value for this property is false.
To use this property, you must set useWideViewport property and screenLevelWidget property to true, else the behavior is undefined.
Example
//Sample code to enable enableOverviewMode property in Browser widget.
frmBrowser.myBrowser.enableOverviewMode=true;
Platform Availability
Available on Android 8
Makes the content of the Browser scrollable.
Syntax
enableParentScrollingWhenReachToBoundaries
Type
Boolean
Read/Write
Read+Write
Remarks
This is a non-Constructor property.
Default value of this property is true.
You must set this property as false to make the Browser content scrollable. For example, if a Browser has PDF content in it, you must set this property as false to make the content scrollable.
Limitation
If a Browser has a scrollable parent, the parent cannot be scrolled further once you reach the end of the Browser. Touch the parent to scroll it. This limitation is applicable when you set this property to false.
Example
formHome.browser.enableParentScrollingWhenReachToBoundaries = false;
Platform Availability
This property helps you to enable or disable the Safe Browsing feature in a Browser widget.
Syntax
enableSafeBrowsing
Type
Boolean
Read/Write
Read+Write
Remarks
Note: Android Apps where the target SDK has been set less than Android 8 (API level 26), cannot use enableSafeBrowsing Property. Such apps should add the following manifest tag to enable Safe Browsing. To add the tag go to Project Settings>Native>Android>Tags>Child Tag Entries under<manifest> tag and provide the following code. <meta-data android:name="android.webkit.WebView.EnableSafeBrowsing"
android:value="true" />
This manifest tag is also helpful if you have multiple Browser widgets in your application. However, this tag has lower precedence over enableSafeBrowsing Property.
Example
//Sample code to enable enableSafeBrowsing property in Browser widget.
frmBrowser.myBrowser.enableSafeBrowsing=true;
Platform Availability
Sets the rendering of the browser contents using software, not hardware.
Syntax
enableSoftwareRendering
Type
Boolean
Read/Write
Read + Write
Remarks
The default value for this property is false.
This property is only supported on Android. By default the Browser contents on Android devices is rendered by the hardware rendering layer. In a few devices, hardware rendering of the Browser widget may fail under low memory situations leading to blank area in the Browser widget’s space on screen.
To handle this issue, the browser rendering can be moved from hardware to software which ensures that the Browser widget is always displayed properly.
If you configure the enableSoftwareRendering property value as True, the Browser widget refresh rate decreases. The decrease in the Browser widget refresh rate will impact the refresh rate of animations, GIFs, and videos in the browser.
Example
formHome.browser.enableSoftwareRendering = true;
Platform Availability
Specifies if third party cookies must be enabled.
Syntax
enableThirdPartyCookies
Type
Boolean
Read/Write
Read + Write
Example
formHome.browser.enableThirdPartyCookies = true;
Platform Availability
Specifies if Zoom (ability to change the scale of the view area) must be enabled.
Syntax
enableZoom
Type
Boolean
Read/Write
Read + Write
Remarks
The default value for this property is false.
If set to true, the Zoom feature is enabled.
If set to false, the Zoom feature is disabled.
Example
//Sample code to enable enableZoom property in Browser widget.
frmBrowser.myBrowser.enableZoom=true;
Platform Availability
It determines the height of the widget and measured along the y-axis.
The height property determines the height of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. For supported widgets, the height may be derived from either the widget or container’s contents by setting the height to “preferred”.
Syntax
height
Type
Number, String, and Constant
Read/Write
Read + Write
Remarks
Following are the available measurement options:
Example
//Sample code to set the height property for widgets by using DP, Percentage and Pixels. frmHome.browser1.height="50dp"; frmHome.browser1. height="10%"; frmHome.browser1. height="10px";
Platform Availability
Specifies the HTML content for the Browser widget.
Syntax
htmlString
Type
String
Read/Write
Read + Write
Example
//Sample code to set htmlString property in Browser widget.
var htmlStringWelcome= "<html>Welcome</html>";
frmBrowser.myBrowser.htmlString=htmlStringWelcome;
Platform Availability
id is a unique identifier of Browser widget consisting of alpha numeric characters. Every Browser should have a unique id within a Form.
Syntax
id
Type
String
Read/Write
Read only
Example
//Defining the properties for a Browser widget with id :"browserID" var webBasic = { id: "browserID", isVisible: true, screenLevelWidget: false }; var webLayout = { containerWeight: 100 }; //Creating the Browser. var browser = new kony.ui.Browser(webBasic, webLayout, {}); //Reading the id of the Browser alert("Browser id ::" + browser.id);
Platform Availability
A custom JSObject with the key value pairs that a developer can use to store the context with the widget. This will help in avoiding the globals to most part of the programming.
Syntax
info
Type
JSObject
Read/Write
Read + Write
Remarks
This is a non-Constructor property. You cannot set this property through widget constructor. But you can read and write data to it.
Info property can hold any JSObject. After assigning the JSObject to info property, the JSObject should not be modified. For example,
var inf = {a: 'hello'}; widget.info = inf; //works widget.info.a = 'hello world'; //This will not update the widget info a property to Hello world. //widget.info.a will have old value as hello.
Example
//Sample code to set info property for a Browser widget frmBrowser.myBrowser.info = { key: "zoom of browser" }; //Reading the info of the Browser widget. kony.print("Browser info ::" + frmBrowser.myBrowser.info);
Platform Availability
This property controls the visibility of a widget on the form.
Syntax
isVisible
Type
Boolean
Read/Write
Read + Write
Remarks
The default value for this property is true.
If set to false, the widget is not displayed.
If set to true, the widget is displayed.
You can also set the visibility of a widget dynamically from code using the setVisibility method.
Example
//Sample code to set isVisible property for a Browser widget frmBrowser.myBrowser.isVisible=true;
Platform Availability
This property determines the lower left corner edge of the widget and is measured from the left bounds of the parent container.
The left property determines the position of the left edge of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. In freeform layout, the distance is measured from the left edge of the parent container. In flow-vertical layout, the distance is measured from the left edge of the parent container. In flow-horizontal layout, the distance is measured from the right edge of the previous sibling widget in the hierarchy.
Syntax
left
Type
String
Read/Write
Read + Write
Remarks
If the layoutType is set as kony.flex.FLOW_HORIZONTAL, the left property is measured from right edge of the left sibling widget.
Example
//Sample code to set the left property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.left = "50dp"; frmHome.widgetID.left = "10%"; frmHome.widgetID.left = "10px";
Platform Availability
This property specifies the maximum height of the widget and is applicable only when the height property is not specified.
The maxHeight property determines the maximum height of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. The maxHeight value overrides the preferred, or “autogrow” height, if the maxHeight is less than the derived content height of the widget.
Syntax
maxHeight
Type
Number
Read/Write
Read + Write
Example
//Sample code to set the maxHeight property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.maxHeight = "50dp"; frmHome.widgetID.maxHeight = "10%"; frmHome.widgetID.maxHeight = "10px";
Platform Availability
This property specifies the maximum width of the widget and is applicable only when the width property is not specified.
The Width property determines the maximum width of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. The maxWidth value overrides the preferred, or “autogrow” width, if the maxWidth is less than the derived content width of the widget.
Syntax
maxWidth
Type
Number
Read/Write
Read + Write
Example
//Sample code to set the maxWidth property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.maxWidth = "50dp"; frmHome.widgetID.maxWidth = "10%"; frmHome.widgetID.maxWidth = "10px";
Platform Availability
This property specifies the minimum height of the widget and is applicable only when the height property is not specified.
The minHeight property determines the minimum height of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. The minHeight value overrides the preferred, or “autogrow” height, if the minHeight is larger than the derived content height of the widget.
Syntax
minHeight
Type
Number
Read/Write
Read + Write
Example
//Sample code to set the minHeight property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.minHeight = "50dp"; frmHome.widgetID.minHeight = "10%"; frmHome.widgetID.minHeight = "10px";
Platform Availability
This property specifies the minimum width of the widget and is applicable only when the width property is not specified.
The minWidth property determines the minimum width of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. The minWidth value overrides the preferred, or “autogrow” width, if the minWidth is larger than the derived content width of the widget.
Syntax
minWidth
Type
Number
Read/Write
Read only
Example
//Sample code to set the minWidth property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.minWidth = "50dp"; frmHome.widgetID.minWidth = "10%"; frmHome.widgetID.minWidth = "10px";
Platform Availability
This property is used to set the behavior of Browser widget, when a secure URL tries to load a content that is not secure.
Syntax
mixedContentMode
Type
Constant
Read/Write
Read + Write
Remarks
The default value of this property is constants.BROWSER_MIXED_CONTENT_NEVER_ALLOW.
You can set any of the following value to this property.
mixedContentMode
property is set to this value, the Browser widget will load all content from a secure origin. This mode of loading content is least secure and is not recommended.mixedContentMode
property is set to this value, the Browser widget will not load a content without certifications even if it is from a secure origin. This mode of loading content is secure and is recommended.mixedContentMode
property is set to this value, the Browser widget behaves similar to a web browser and attempts to load the content without certifications. This content may be loaded or blocked depending on the release and is not explicitly defined. You can use this mode of loading content when your application is not in control of the content, but the content is being operated from a secure environment.Example
//Sample code to set mixedContentMode property for a Browser widget.
frmBrowser.myBrowser.mixedContentMode = constants.BROWSER_MIXED_CONTENT_COMPATIBILITY_MODE;
Platform Availability
Note: In an application with target SDK as Android 9 (API level 28), the cleartext content for specific domains is blocked. To enable cleartext for specific domains, you must configure cleartexttraffic in the network security configuration. For more information on cleartexttraffic, click here.
Specifies the opacity of the widget. The value of this property must be in the range 0.0 (transparent) to 1.0 (opaque). Any values outside this range are fixed to the nearest minimum or maximum value.
Specifies the opacity of the widget. Valid opacity values range from 0.0 (transparent), to 1.0 (opaque). Values set to less than zero will default to zero. Values more than 1.0 will default to 1. Interaction events set on a transparent widget will still be fired. To disable the events, also set the “isVisible” property to “false”.
Syntax
opacity
Type
Number
Read/Write
Read + Write
Remarks
Note: This property has more priority compared to the values coming from the configured skin.
Example
//Sample code to make the widget transparent by using the opacity property. frmHome.widgetID.opacity = 0; //Sample code to make the widget opaque by using the opacity property. frmHome.widgetID.opacity = 1;
Platform Availability
Defines the space between the content of the widget and the widget boundaries. You can use this option to define the top, left, right, and bottom distance between the widget content and the widget boundary.
When you are defining the padding (for any platform) the first time, the value that you enter in the padding field (top, left, right, or bottom) is auto-populated across all the platforms.
The following image illustrates a widget with a defined padding:
Syntax
padding
Type
Array of numbers
Read / Write
Read+Write
Limitations
Desktop Web/ SPA platforms do not support padding property in Image widget, Slider widget and Switch widget.
Example
//Sample code to set the padding property for widgetID Button widget in frmHome Form. frmHome.widgetID.padding= [2,2,2,2];
Platform Availability
This property specifies whether the padding property is to be applied in pixels or in percentage.
Syntax
paddingInPixel
Type
Boolean
Read/Write
Read Only
Remarks
The default value of this property is false.
If the value of this property is true, the padding are applied in pixels.
If the value of this property is false, the padding are applied as set in padding property.
Limitations
Desktop Web/ SPA platforms do not support paddingInPixel property in Image widget, Slider widget and Switch widget.
Example
//Sample code to read paddingInPixel property for widgetID Button widget in frmHome form. kony.print("PaddingInPixel property value is:"+fromHome.widgetID.paddingInPixel);
Platform Availability
Helps you access the parent of the widget. If the widget is not part of the widget hierarchy, the parent property returns null.
Syntax
parent
Read/Write
Read only
Remarks
Note: The property works for all the widgets whether they are placed inside a FlexContainer, a Form, or an HBox.
Example
function func() { kony.print("The parent of the widget" + JSON.stringify(Form1.widgetID.parent)); }
Platform Availability
You can use this property to enable Full Screen viewing of videos in webpages in Browser widget. After enabling this property, by clicking the Full Screen Expansion button, you can make the videos play in full-screen view.
Syntax
playVideoInFullScreen
Type
Boolean
Read/Write
Read + Write
Example
frm1.browser1.playVideoInFullScreen = true;
Platform Availability
Specifies the configurations for the requested URL in key-value pairs as a JavaScript object or Lua table.
Syntax
requestURLConfig
Type
JSObject
Read/Write
Read + Write
Remarks
The following are the keys that are accepted in this object.
Specifies the initial URL that must be requested from the server. The URL must begin with http:// .
Specifies the HTTP method to use for requesting the initial URL. You can choose either:
- BROWSER_REQUEST_METHOD_GET (Default)
Note: SPA platforms supports BROWSER_REQUEST_METHOD_GET option only.
- BROWSER_REQUEST_METHOD_POST
Specifies the key-value pairs that must be sent to the initial URL. It accepts an array of array. For example,
[["key1","value1"],["key2","value2"],["keyn", "valuen"]]
Example
//Sample code to invoke requestURLConfig property for a Browser widget.
var urlConf = { URL: "https://www.google.co.in/", requestMethod: constants.BROWSER_REQUEST_METHOD_GET, headers: headersConf };
frmBrowser.myBrowser.requestURLConfig=urlConf;
Platform Availability
This property is used to retain the content alignment property value, as it was defined.
Note: Locale-level configurations take priority when invalid values are given to this property, or if it is not defined.
The mirroring widget layout properties should be defined as follows.
function getIsFlexPositionalShouldMirror(widgetRetainFlexPositionPropertiesValue) { return (isI18nLayoutConfigEnabled && localeLayoutConfig[defaultLocale] ["mirrorFlexPositionalProperties"] == true && !widgetRetainFlexPositionPropertiesValue); }
The following table illustrates how widgets consider Local flag and Widget flag values.
Properties | Local Flag Value | Widget Flag Value | Action |
---|---|---|---|
Mirror/retain FlexPositionProperties | true | true | Use the designed layout from widget for all locales. Widget layout overrides everything else. |
Mirror/retain FlexPositionProperties | true | false | Use Mirror FlexPositionProperties since locale-level Mirror is true. |
Mirror/retain FlexPositionProperties | true | not specified | Use Mirror FlexPositionProperties since locale-level Mirror is true. |
Mirror/retain FlexPositionProperties | false | true | Use the designed layout from widget for all locales. Widget layout overrides everything else. |
Mirror/retain FlexPositionProperties | false | false | Use the Design/Model-specific default layout. |
Mirror/retain FlexPositionProperties | false | not specified | Use the Design/Model-specific default layout. |
Mirror/retain FlexPositionProperties | not specified | true | Use the designed layout from widget for all locales. Widget layout overrides everything else. |
Mirror/retain FlexPositionProperties | not specified | false | Use the Design/Model-specific default layout. |
Mirror/retain FlexPositionProperties | not specified | not specified | Use the Design/Model-specific default layout. |
Syntax
retainContentAlignment
Type
Boolean
Read/Write
No (only during widget-construction time)
Example
//This is a generic property that is applicable for various widgets. //Here, we have shown how to use the retainContentAlignment property for Button widget. /*You need to make a corresponding use of the retainContentAlignment property for other applicable widgets.*/ var btn = new kony.ui.Button({ "focusSkin": "defBtnFocus", "height": "50dp", "id": "myButton", "isVisible": true, "left": "0dp", "skin": "defBtnNormal", "text": "text always from top left", "top": "0dp", "width": "260dp", "zIndex": 1 }, { "contentAlignment": constants.CONTENT_ALIGN_TOP_LEFT, "displayText": true, "padding": [0, 0, 0, 0], "paddingInPixel": false, "retainFlexPositionProperties": false, "retainContentAlignment": true }, {});
Platform Availability
This property is used to retain flex positional property values as they were defined. The flex positional properties are left, right, and padding.
Note: Locale-level configurations take priority when invalid values are given to this property, or if it is not defined.
The mirroring widget layout properties should be defined as follows.
function getIsFlexPositionalShouldMirror(widgetRetainFlexPositionPropertiesValue) { return (isI18nLayoutConfigEnabled && localeLayoutConfig[defaultLocale] ["mirrorFlexPositionalProperties"] == true && !widgetRetainFlexPositionPropertiesValue); }
The following table illustrates how widgets consider Local flag and Widget flag values.
Properties | Local Flag Value | Widget Flag Value | Action |
---|---|---|---|
Mirror/retain FlexPositionProperties | true | true | Use the designed layout from widget for all locales. Widget layout overrides everything else. |
Mirror/retain FlexPositionProperties | true | false | Use Mirror FlexPositionProperties since locale-level Mirror is true. |
Mirror/retain FlexPositionProperties | true | not specified | Use Mirror FlexPositionProperties since locale-level Mirror is true. |
Mirror/retain FlexPositionProperties | false | true | Use the designed layout from widget for all locales. Widget layout overrides everything else. |
Mirror/retain FlexPositionProperties | false | false | Use the Design/Model-specific default layout. |
Mirror/retain FlexPositionProperties | false | not specified | Use the Design/Model-specific default layout. |
Mirror/retain FlexPositionProperties | not specified | true | Use the designed layout from widget for all locales. Widget layout overrides everything else. |
Mirror/retain FlexPositionProperties | not specified | false | Use the Design/Model-specific default layout. |
Mirror/retain FlexPositionProperties | not specified | not specified | Use the Design/Model-specific default layout. |
Syntax
retainFlexPositionProperties
Type
Boolean
Read/Write
No (only during widget-construction time)
Example
//This is a generic property that is applicable for various widgets. //Here, we have shown how to use the retainFlexPositionProperties property for Button widget. /*You need to make a corresponding use of the retainFlexPositionProperties property for other applicable widgets.*/ var btn = new kony.ui.Button({ "focusSkin": "defBtnFocus", "height": "50dp", "id": "myButton", "isVisible": true, "left": "0dp", "skin": "defBtnNormal", "text": "always left", "top": "0dp", "width": "260dp", "zIndex": 1 }, { "contentAlignment": constants.CONTENT_ALIGN_CENTER, "displayText": true, "padding": [0, 0, 0, 0], "paddingInPixel": false, "retainFlexPositionProperties": true, "retainContentAlignment": false }, {});
Platform Availability
This property is used to convert Flow Horizontal Left to Flow Horizontal Right.
Note: Locale-level configurations take priority when invalid values are given to this property, or if it is not defined.
The mirroring widget layout properties should be defined as follows.
function getIsFlexPositionalShouldMirror(widgetRetainFlexPositionPropertiesValue) { return (isI18nLayoutConfigEnabled && localeLayoutConfig[defaultLocale] ["mirrorFlexPositionalProperties"] == true && !widgetRetainFlexPositionPropertiesValue); }
The following table illustrates how widgets consider Local flag and Widget flag values.
Properties | Local Flag Value | Widget Flag Value | Action |
---|---|---|---|
Mirror/retain FlexPositionProperties | true | true | Use the designed layout from widget for all locales. Widget layout overrides everything else. |
Mirror/retain FlexPositionProperties | true | false | Use Mirror FlexPositionProperties since locale-level Mirror is true. |
Mirror/retain FlexPositionProperties | true | not specified | Use Mirror FlexPositionProperties since locale-level Mirror is true. |
Mirror/retain FlexPositionProperties | false | true | Use the designed layout from widget for all locales. Widget layout overrides everything else. |
Mirror/retain FlexPositionProperties | false | false | Use the Design/Model-specific default layout. |
Mirror/retain FlexPositionProperties | false | not specified | Use the Design/Model-specific default layout. |
Mirror/retain FlexPositionProperties | not specified | true | Use the designed layout from widget for all locales. Widget layout overrides everything else. |
Mirror/retain FlexPositionProperties | not specified | false | Use the Design/Model-specific default layout. |
Mirror/retain FlexPositionProperties | not specified | not specified | Use the Design/Model-specific default layout. |
Syntax
retainFlowHorizontalAlignment
Type
Boolean
Read/Write
No (only during widget-construction time)
Example
//This is a generic property that is applicable for various widgets. //Here, we have shown how to use the retainFlowHorizontalAlignment property for Button widget. /*You need to make a corresponding use of the retainFlowHorizontalAlignment property for other applicable widgets. */ var btn = new kony.ui.Button({ "focusSkin": "defBtnFocus", "height": "50dp", "id": "myButton", "isVisible": true, "left": "0dp", "skin": "defBtnNormal", "text": "always left", "top": "0dp", "width": "260dp", "zIndex": 1 }, { "contentAlignment": constants.CONTENT_ALIGN_CENTER, "displayText": true, "padding": [0, 0, 0, 0], "paddingInPixel": false, "retainFlexPositionProperties": true, "retainContentAlignment": false, "retainFlowHorizontalAlignment ": false }, {});
Platform Availability
This property determines the lower right corner of the widget and is measured from the right bounds of the parent container.
The right property determines the position of the right edge of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. In freeform layout, the distance is measured from the left edge of the parent container. In flow-vertical layout, value is ignored. In flow-horizontal layout, the value is ignored.
The right property is used only if the width property is not provided.
Syntax
right
Type
String
Read/Write
Read + Write
Remarks
If the layoutType is set as kony.flex.FLOW_HORIZONTAL, the right property is measured from left edge of the right sibling widget. The horizontal space between two widgets is measured from right of the left sibling widget and left of the right sibling widget.
Example
//Sample code to set the right property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.right = "50dp"; frmHome.widgetID.right = "10%"; frmHome.widgetID.right = "10px";
Platform Availability
Specifies whether the widget should occupy the whole container or not when your Browser widget has a large HTML content to display.
Syntax
screenLevelWidget
Type
Boolean
Read/Write
No
Remarks
The default value for this property is false.
You must set the value to true for your Browser widget occupy the complete Form and results in a good user experience.
If set to false, the widget does not occupy the whole container and a scroll bar appears on the Browser widget and the Form resulting in a bad user experience while scrolling.
You must not place more than one Browser widget as a screen level widget inside a Form. Also, if you choose to make a Browser widget a Screen Level Widget, you must place only the Browser widget in the Form and must not place any other widgets in the Form.
Do not set the screen level widget property to true for more than one widget in the form. If you have multiple widgets with this property set as true, there may be issues with how information is displayed along with some scrolling issues.
Few guidelines for using screenLevelWidget property for Browser widget.
On iPhone, Android, and Windows platforms, if this property is set to true, the following are applicable:
iPhone
When a browser widget is used on the form, make sure that all other widgets are part of header or footer of the form.
Android
Only the widgets placed above the Browser widget (which is a screen level widget) are visible. The widgets placed below the Browser widget are not visible when rendered.
Windows
The widgets placed above and below the Browser widget (which is a screen level widget) are not visible when rendered.
Note: If you configure Application level Header and Footer, they will be visible even if the browser is a screen level widget.
Example
//Sample code to enable screenLevelWidget property in Browser widget.
frmBrowser.myBrowser.screenLevelWidget=true;
Platform Availability
This property enables you to scroll the Browser to top, on tapping a device’s status bar.
Syntax
scrollsToTop
Type
Boolean
Read/Write
Read + Write
Remarks
The default value for this property is true.
If this property is true for more than one widget, then this property is not applied to any of the widgets.
Example
//Sample code to disable scrollsToTop property in Browser widget.
frmBrowser.myBrowser.scrollsToTop=false;
Platform Availability
The settings property helps you to configure the Browser Widget settings.
Syntax
settings
Type
Boolean
Read/Write
Read + Write
Remarks
enableJavaScript Key
The property is configured as key-value pairs. The settings property accepts the enableJavaScript key. The enableJavaScript key allows to enable or disable the JavaScript in the Browser Widget. Following are the values accepted by the key:
{“enableJavaScript”:true}
{“enableJavaScript”:false}
The default value for the enableJavaScript key is true.
If the enableJavaScript key is set to false, the JavaScript is disabled in the Browser Widget.
If the enableJavaScript key is set to true, the JavaScript is enabled in the Browser Widget.
The values other than "true" and "false" are discarded.
Note: Once the JavaScript is disabled and the Browser Widget is loaded, it is not possible to enable the JavaScript dynamically.
allowFileAccess Key
The settings property accepts the allowFileAccess key, which enables or disables file access in the Browser Widget.
{“allowFileAccess”:true}
{“allowFileAccess”:false}
The default value for allowFileAccess is true.
If the allowFileAccess is set to false, file access is disabled in the browser widget.
If the allowFileAccess is set to true, file access is enabled in the browser widget.
The values other than true and false are discarded.
The allowFileAccess key enables or disables file system access only. Assets and resources are still accessible using file:///android_asset
and file:///android_res
If the Browser widget has to access any files through java script code ( for example, in button onclick accessing the sdcard files) , the enableJavaScript key and the allowFileAccess key should be configured to true. If the enableJavaScript is set to false and the allowFileAccess is set to true, the browser widget cannot access files.
Once the allowFileAccess key is disabled, and the Browser Widget is loaded, it is not possible to enable the allowFileAccess key dynamically.
Example
//Sample code to enable settings property in Browser widget.
frmBrowser.myBrowser.settings= { "enableJavaScript": false, "allowFileAccess": false };
Platform Availability
In the iOS platform, the Browser widget uses WKWebView engine to load data. WKWebView engine does not allow you to use cookie from one browser in another. From Visualizer V8 SP4 FP83 version, you can use the shareCookiesInBrowsers property to enable sharing of cookies between browsers. You can only share the cookies between browsers that have enabled the shareCookiesInBrowsers property.
This is a constructor level property.
Syntax
shareCookiesInBrowsers
Type
Boolean
The default value of this property is false.
When the value of this property is true, you can share the cookies between the browsers.
When the value of this property is false, you cannot share the cookies between the browsers.
Read/Write
Read Only
Example
//Sample code to enable the shareCookiesInBrowsers property in Browser widget. var urlConf = { URL: "help/index.html", requestMethod: constants.BROWSER_REQUEST_METHOD_GET }; var webBasic = { id: "browserID", isVisible: true, requestURLConfig: UrlConf }; var webLayout = { containerHeight: 100 }; var webPsp = { "shareCookiesInBrowsers": true }; var browserID = new kony.ui.Browser(webBasic, webLayout, webPsp);
Platform Availability
Specifies if the progress indicator must be displayed before loading the URL or executing an event.
Syntax
showProgressIndicator
Type
Boolean
Read/Write
Read + Write
Remarks
The default value for this property is true.
If set to false, the progress indicator is not displayed on the widget.
If set to true, the progress indicator is displayed on the widget.
Example
//Sample code to disable showProgressIndicator property in Browser widget.
frmBrowser.myBrowser.showProgressIndicator=false;
Platform Availability
Prior to Visualizer V8.4.91 version, in the iOS platform, SSL validations occurred based on the values of allowbundledonly and KonyHTTPPublicKeyPinning in the infoplist_configuration.json
file. From the Visualizer V9 version onwards, Browser widget supports only WKWebview engine. WKWebView engine enables pinning for all HTTPS URLs used inside the Browser widget. This means that all the hosts accessed in the Browser widget can be pinned using either public key pinning or SSL certificate pinning.
From the Visualizer V8.4.91 version , you can use the SSLValidationBehavior
property to handle the SSL pinning and validation behavior of Browser widget in the iOS platform. This property can be used when public key pinning or SSL certificate pinning is enabled.
Syntax
SSLValidationBehavior
Type
Constant
You can provide any of the following constants as input to SSLValidationBehavior
property.
constants. SSL_VALIDATION_BEHAVIOR_NONE
: When this value is assigned to the SSLValidationBehavior property, no Pinning validations will be performed on any URL.constants.SSL_VALIDATION_BEHAVIOR_DEFAULT
: When this value is assigned to theSSLValidationBehvior property, only those URLs that are pinned are validated. All the URLs that are not pinned are rejected. This is the default value of this property.constants.
SSL_VALIDATION_BEHAVIOR_CHECK_DECLARED_ALLOW_OTHERS
: When this value is assigned to the SSLValidationBehavior property, the URLs that are pinned are validated. The URLs that are not pinned are not validated but these URLs are not rejected.For more information on the behavior of these constants, refer the table provided under Remarks.
Read/Write
Read Only
Remarks
The following table lists the behavior of SSLValidationBehavior property with the various values of allowbundledonly and KonyHTTPPublicKeyPinning in infoplist_configuration.json file.
allowbundledonly (Certificate Pinning) |
KonyHTTPPublishKeyPinning (Public Key Pinning) |
SSLValidationBehavior | Result |
---|---|---|---|
False | True | SSL_VALIDATION_BEHAVIOR_NONE | All URLs are bypassed. |
True | False | SSL_VALIDATION_BEHAVIOR_NONE | All URLs are bypassed. |
False | True | SSL_VALIDATION_BEHAVIOR_DEFAULT | Only pinned URLs are validated. Rest of the URLs are rejected. |
True | False | SSL_VALIDATION_BEHAVIOR_DEFAULT | Only the URLs with the certificates pinned are validated. Rest of the URLs are rejected. |
False | True | SSL_VALIDATION_BEHAVIOR_CHECK_DECLARED_ALLOW_OTHERS | The pinned URLs are validated. Rest are bypassed |
True | False | SSL_VALIDATION_BEHAVIOR_CHECK_DECLARED_ALLOW_OTHERS | The pinned certificates are validated. Rest are bypassed |
Example
//Sample code to set the behavior of SSL pinning in Browser widget. var myBrowser = new kony.ui.Browser({ id: "myBrowser", isVisible: true, }, { containerHeight: 100, margin: [10, 10, 10, 10] }, { SSLValidationBehavior: constants.SSL_VALIDATION_BEHAVIOR_NONE });
Platform Availability
This property is used to deep link URLs between applications. The supportedURLSchemes
property is used to provide the keys of the custom URLs required to launch the application URLs using the Browser widget.
Syntax
supportedURLSchemes
Type
Array of Strings
Read/Write
Read + Write
Example
//Sample code to add keys in supportedURLSchemes property in Browser widget.
frmBrowser.myBrowser.supportedURLSchemes =[“customURLkey1”,"customURLkey2”];
Platform Availability
This property determines the top edge of the widget and measured from the top bounds of the parent container.
The top property determines the position of the top edge of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. In freeform layout, the distance is measured from the top edge of the parent container. In flow-vertical layout, the distance is measured from the bottom edge of the previous sibling widget in the hierarchy. In flow-horizontal layout, the distance is measured from the left edge of the parent container.
Syntax
top
Type
String
Read/Write
Read + Write
Remarks
If the layoutType is set as kony.flex.FLOW_VERTICAL, the top property is measured from the bottom edge of the top sibling widget. The vertical space between two widgets is measured from bottom of the top sibling widget and top of the bottom sibling widget.
Example
//Sample code to set the top property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.top = "50dp"; frmHome.widgetID.top = "10%"; frmHome.widgetID.top = "10px";
Platform Availability
Contains an animation transformation that can be used to animate the widget.
Syntax
transform
Type
JSObject
Read/Write
Read + Write
Remarks
This property is set to the identify transform by default. Any transformations applied to the widget occur relative to the widget's anchor point. The transformation contained in this property must be created using the kony.ui.makeAffineTransform function.
Example
This example uses the button widget, but the principle remains the same for all widgets that have a transform property.
//Animation sample var newTransform = kony.ui.makeAffineTransform(); newTransform.translate3D(223, 12, 56); //translates by 223 xAxis,12 in yAxis,56 in zAxis widget.transform = newTransform;
Platform Availability
Specifies whether the browser should enable support for the "viewport" HTML meta tag or should use the wide viewport. If this property is set to true, it loads the browser with the attributes defined in the meta tag of the webpage. It scales the web page as defined in the html.
Syntax
useWideViewport
Type
Boolean
Read/Write
Write only
Remarks
The default value for this property is false.
If this property is set to true, it loads the browser with the attributes defined in the meta tag of the webpage. It scales the web page as defined in the html.
Example
//Sample code to enable useWideViewport property in Browser widget.
frmBrowser.myBrowser.useWideViewport=true;
Platform Availability
Available on Android / Android Tablet platforms
This property determines the width of the widget and is measured along the x-axis.
The width property determines the width of the widget’s bounding box. The value may be set using DP (Device Independent Pixels), Percentage, or Pixels. For supported widgets, the width may be derived from either the widget or container’s contents by setting the width to “preferred”.
Syntax
width
Type
Number, String, and Constant
Read/Write
Read + Write
Remarks
Following are the options that can be used as units of width:
Example
//Sample code to set the width property for widgets by using DP, Percentage and Pixels. frmHome.widgetID.width = "50dp"; frmHome.widgetID.width = "10%"; frmHome.widgetID.width = "10px";
Platform Availability
This property specifies the stack order of a widget. A widget with a higher zIndex is always in front of a widget with a lower zIndex.
The zIndex property is used to set the stack, or layer order of a widget. Widgets with higher values will appear “over”, or “on top of” widgets with lower values. Widgets layered over other widgets will override any interaction events tied to widgets beneath. Modifying the zIndex does not modify the order of the widgets in the Kony hierarchy, inside of a flexContainer or form. zIndex accepts both negative and positive values.
Syntax
zIndex
Type
Number
Read/Write
Read + Write
Remarks
The default value for this property is 1.
Note: Modifying the zIndex does not modify the order of the widgets inside the FlexContainer. If zIndex is same for group of overlapping widgets then widget order decides the order of overlapping. The last added widget is displayed on top.
Example
//Sample code to set the zIndex property for widgets.
frmHome.widgetID.zIndex = 300;
Platform Availability
Specifies the default zoom density of the page.
Syntax
zoomDensity
Type
Number
Read/Write
Write only
Remarks
Example
//Sample code to set zoomDensity property in Browser widget.
frmBrowser.myBrowser.zoomDensity=0;
Platform Availability
Available on Android
prem | Copyright © 2012 Kony, Inc. All rights reserved. |
prem | Copyright © 2012 Kony, Inc. All rights reserved. |