Chrome downloaded file name $
Project Gutenberg is an online library where you can download e-books for free. But every time I download one, the file has a stupid filename, like abjx I decided to do something about it and create a plugin so that the file is automatically renamed with the book title followed by the book's authors' names. The goal is to have a file with a name useful for Windows' search function. In this article, I'll walk you through the development stages and the plugin's code.
This is my first Google Chrome plugin and I'm not a javascript developer so suggestions for improvement are welcome. Here is a video of what the plugin achieves. On the video, we can see that I download a book from Project Gutenberg. Then, I activate the plugin before re-downloading the same book. To create an extension, we must create a new folder with a json file called manifest.
This manifest file is the entry point for chrome to recognize and load the extension. The minimal content of manifest. First, we need a way to get the book's title. To do so, we will parse the download page with a content script. A content script is a javascript code that executes when a given page is loaded.
It can read details i. Active Oldest Votes. Obtain an HTTP trace, or test your site with redbot. BTW: the trailing colon in the first parameter to setHeader looks fishy.
Improve this answer. Julian Reschke Julian Reschke I'd definitely use something like Fiddler or Wireshark to see exactly what the browser is receiving. Good pickup on the trailing colon. You shouldn't need it as set header will separate the key and value with the colon — Mr Moose. Added test case at greenbytes. Is it possible that the charset might be the difference? Mr Moose Mr Moose 5, 6 6 gold badges 32 32 silver badges 64 64 bronze badges.
No, the charset parameter on Content-Type applies to the payload, not the header fields. Removing the trailing colon in the first parameter to setHeader fixed the issue. Sign up or log in Sign up using Google.
Sign up using Facebook. Sign up using Email and Password. Windows 11 Performance. Edge Shopping Features. Spotify Lyrics. Windows 11 Mute Keyboard Shortcut. Find Downloaded Files on an iPhone. Use Your iPhone as a Webcam. Hide Private Photos on iPhone.
Take Screenshot by Tapping Back of iPhone. Should You Upgrade to Windows 11? Browse All Windows Articles. OneDrive Windows 7 and 8. Copy and Paste Between Android and Windows. Protect Windows 10 From Internet Explorer. Mozilla Fights Double Standard.
Connect to a Hidden Wi-Fi Network. Change the Size of the Touch Keyboard. Check Bluetooth Device Battery Life. Reader Favorites Take Screenshot on Windows. Mount an ISO image in Windows. Boot Into Safe Mode. Where to Download Windows Legally. Find Your Lost Product Keys.
0コメント