openInBrowser JS API
Use Case
openInBrowser is used to download any file in Mini Apps by passing the control to mobile browser eg. PDF.
Note: openInBrowser currently not supported in UAT app.
Request Attributes
Content format: JSON
Parameter | Description | Required | Example Value |
---|---|---|---|
url | URL of the file to download | Yes | https://dummyurl.pdf |
Response Attributes
Success:
Parameter | Description | Example Value |
---|---|---|
success | Boolean | true |
REQUEST CODERESPONSE CODE
JAVASCRIPT
const requestObject={
url: 'https://dummyurl.pdf',
}
function ready (callback) {
// call if jsbridge is injected
if(window.JSBridge) {
callback && callback();
} else{
// listen to jsbridge ready event
document.addEventListener('JSBridgeReady',
callback, false);
}}
ready(function () {
JSBridge.call('openInBrowser',requestObject)
});