Reputation: 2183
I am trying to write a chrome extension in which I have to create a desktop shortcut of the current webpage.
This is what I tried but it did not create a shortcut but downloaded the html file instead.
chrome.tabs.getSelected(null, function(tab) {
chrome.downloads.download({
url: tab.url,
filename: "abc.html"
});
});
I really think this question has been asked before but I could not find the answer anywhere. I'm really sorry if this is a duplicate.
Thank you.
Upvotes: 2
Views: 833
Reputation: 2183
I found the solution myself.
I have to write a file to the disk named filename.url
which contains the following lines:
[InternetShortcut]
URL=url-to-webpage
Upvotes: 1