I have a windows app with a custom protocol of 'opendental:' which can also accept parameters as 'opendental://1/2/3/4'. This works if entered directly in the browser; however, i can't seem to bypass retools limitations.
If I attempt to use utils.OpenUrl() I receive the following error: Error:Invalid URL: the URL may only start with one of the following protocols: http, https, mailto, tel, sms, facetime, callto, cid, xmpp, slack, ftp, ftps
If not, try a custom component that wraps the Windows API function ShellExecute(). This function then allows you to open any file or URL, including custom protocols.
To create a custom component, you will need to create a new file with the .vue extension. The file should contain the following code:
HTML<template>
<div>
<button @click="openLink()">Open Link</button>
</div>
</template>
<script>
export default {
methods: {
openLink() {
// Get the URL to open.
const url = 'opendental://1/2/3/4';
// Open the URL using ShellExecute().
const shellExecute = require('electron').shell.openExternal;
shellExecute(url, { activate: true });
}
}
};
</script>
Once you have created the custom component, you can add it to your Retool app like any other component. Then, you can click the button to open the link in your Windows app.