API reference
Design
addAudioTrackaddElementAtCursoraddElementAtPointaddNativeElementaddPagecreateRichtextRangeeditContentgetCurrentPageContextgetDefaultPageDimensionsgetDesignTokeninitAppElementopenDesignoverlay.registerOnCanOpenrequestExportselection.registerOnChangesetCurrentPageBackgroundui.startDragToCursorui.startDragToPointui.startDrag
Intents: data
Intents: design
Platform
appProcessappProcess.broadcastMessageappProcess.currentappProcess.current.getInfoappProcess.current.requestCloseappProcess.current.setOnDisposeappProcess.requestCloseappProcess.registerOnMessageappProcess.registerOnStateChangefeatures.isSupportedfeatures.registerOnSupportChangegetPlatformInfonotification.addToastrequestOpenExternalUrl
requestOpenExternalUrl
API reference for the requestOpenExternalUrl method.
Opens an external URL.
The URL is opened natively, such as in a new browser tab on desktop or in a browser sheet on mobile.
In some browsers, the user must enable popup permissions before any URL can be opened.
Usage
Open an external URL
import { requestOpenExternalUrl } from '@canva/platform';await requestOpenExternalUrl({url: 'https://www.example.com',});
TYPESCRIPT
Detect when a user navigates to the external URL
import { requestOpenExternalUrl } from '@canva/platform';const response = await requestOpenExternalUrl({url: 'https://www.example.com',});if (response.status === 'completed') {// URL opened successfully}
TYPESCRIPT
Detect when a user doesn't navigate to the external URL
import { requestOpenExternalUrl } from '@canva/platform';const response = await requestOpenExternalUrl({url: 'https://www.example.com',});if (response.status === 'aborted') {// User declined to open URL}
TYPESCRIPT
Parameters
request
OpenExternalUrlRequest
Required
Options for prompting the user to open an external URL.
url
string
Required
The URL to open.
Returns
The result of prompting the user to open an external URL. This is a Promise
that resolves with the following object:
The result when a user agrees to navigate to an external URL.
status
string
The status of the request.
This must be "completed"
.
The result when a user doesn't agree to navigate to an external URL.
status
string
The status of the request.
This must be "aborted"
.