how to drag data (in uri format) from browser to other apps how to drag data (in uri format) from browser to other apps google-chrome google-chrome

how to drag data (in uri format) from browser to other apps


To achive that:

You must be sure that client has the application you want to use. Many user use different application to open a pdf file.

The application that you want to use must registered itself to Operating System for incoming request. (For example on MacOS, App Store application registered itself and you can open an application page by clicking the html link)

if Adobe Reader is the application you want to use, you can search about if it has some future like this.

if you want to hide pdf files from search robots you can create them in your server temp folder and create a random link to them. After client use it, you can simply delete.


check out the Electron API documentation for Dragging files out of a windows (replicated here for archiving):

In web page:

<a href="#" id="drag">item</a><script type="text/javascript" charset="utf-8">  document.getElementById('drag').ondragstart = (event) => {    event.preventDefault()    ipcRenderer.send('ondragstart', '/path/to/item')  }</script>

In the main process:

const {ipcMain} = require('electron')ipcMain.on('ondragstart', (event, filePath) => {  event.sender.startDrag({    file: filePath,    icon: '/path/to/icon.png'  })})