canDecodeUrl

The canDecodeUrl API is called by the super app to verify whether the URL can be decoded by Mini Program Platform.

Method signature

copy
function canDecodeUrl(
  url: string,
  success: (result: boolean) => void,
  error?: (error: BaseError) => void
)

Request parameters

Field

Data type

Required

Description

url

String

Yes

Indicates the URL content that is used to verify whether it can be decoded.

success

Boolean

Yes

The callback function that indicates whether the API call is successful.

error

BaseError

No

The callback function that is executed upon failure to call this API. When executed, it receives an instance of BaseError object that includes the error code and its corresponding error description. Specify this parameter if you need to handle the encountered errors.

Response parameters

N/A

Sample

copy
 function decodeUrl(url:string){
    canDecodeUrl(url,(canDecode:boolean) =>{
       if(canDecode){
        //
       }else{
         //
       }
    })
  }