我正在使用桌面通知。我使用这个代码来显示它,和它的做工精细:将文本文件的内容转换为javascript变量
// If the user is okay, let's create a notification
if (permission === "granted") {
var options = {
body: "This is the body of the notification",
icon: "icon.jpg",
dir : "ltr"
};
var notification = new Notification("Hi there",options);
}
但我怎么能取从文本文件数据到options.body
?
哪里是文本文件是从哪里来的? –
如果你想加载一个文本文件,你可以使用Ajax。但是在使用Ajax之前,您需要设置一个Web服务器。 – undefined
文本文件来自服务器.. notificion.txt – Ryewell