electron 使用操作系统默认应用程序打开(八)
文章目录直接访问工程中的文件直接访问工程中的文件<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>firs
·
文章目录
参考
shell 模块提供了集成其他桌面客户端的关联功能
例子——直接访问工程中的文件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>first electron</title>
</head>
<body>
<div>
<a href="https://hbiao68.blog.csdn.net/" id="myBlog" onclick="openBrowserMyBlog(event)">黄彪的博客</a>
</div>
</body>
<script src="./js/readFile.js"></script>
<script>
// 定制鼠标右键菜单
const {remote, clipboard } = require('electron');
const shell = remote.shell
function openBrowserMyBlog (e) {
e.preventDefault()
let aHrefObj = document.querySelector('#myBlog')
console.log(aHrefObj)
debugger
var href = aHrefObj.getAttribute('href')
shell.openExternal(href)
}
</script>
</html>
更多推荐


所有评论(0)