Question
How to set an app to be opened in the default browser from Launchpad/toolbar instead of in an io.Connect Desktop Window
Answer
An easy solution is to create an app that remains hidden and opens the required URL in the machine’s browser. The customProperties object allows us to configure the app to open any intended URL via the application’s source. Sample code below:
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta ...>
<title>hidden-app</title>
<script src="./index.js"></script>
</head>
<body>
</body>
</html>
index.js
// IO is not imported as it is autoInjected as part of the window sandboxing, but if autoInjection is disabled - you will need to import the IO library manually
IODesktop()
.then(async (io) => {
const currentConfig = await io.appManager.myApplication.userProperties;
const url = currentConfig.url;
window.open(url);
return io.windows.my().close();
})
.catch((error) => {
console.error("Error initializing IODesktop:", error);
});
Config of the application, which should be placed in an app store configured in system.json:
{
"type": "window",
"name": "openInBrowser",
"details": {
"url": "http://localhost:8881/index.html",
"hidden": true
},
"customProperties": {
"url": "https://example.com/"
}
}