FEAT [#20442] : adds the fiddle for launching an app from URL in another app, including all 3 files main.js, index.html, renderer.js (#20718)

This commit is contained in:
Alan Ionita 2019-11-13 05:46:54 +00:00 committed by Cheng Zhao
parent 09533e77da
commit a15e0e0657
3 changed files with 175 additions and 0 deletions

View file

@ -0,0 +1,14 @@
const { shell } = require('electron')
const path = require('path')
const openInBrowserButton = document.getElementById('open-in-browser')
const openAppLink = document.getElementById('open-app-link')
// Hides openAppLink when loaded inside Electron
openAppLink.style.display = 'none'
openInBrowserButton.addEventListener('click', () => {
console.log('clicked')
const pageDirectory = __dirname.replace('app.asar', 'app.asar.unpacked')
const pagePath = path.join('file://', pageDirectory, 'index.html')
shell.openExternal(pagePath)
})