import ReactNative from "react-native" ; param { string } url returns { Promise . < boolean > } export async function OpenURL ( url ? ) { if ( ! url ) { return Promise . reject ( new Error ( "Input parameter 'Url' is required" ) ) ; } if ( navigator && navigator . product === "ReactNative" ) { const Linking = require ( "react-native" ) . Linking ; return Linking . canOpenURL ( url ) . then ( supported => { if ( ! supported ) { return false ; } return Linking . openURL ( url ) . then ( ( ) => true ) ; } ) ; } if ( window && window . cordova ) { window . open ( url , "_system" ) ; return Promise . resolve ( true ) ; } if ( window ) { window . location . href = url ; return Promise . resolve ( true ) ; } return Promise . resolve ( false ) ; }