Skip to content

Commit

Permalink
Merge branch 'developer'
Browse files Browse the repository at this point in the history
  • Loading branch information
jinliming2 committed Jan 4, 2019
2 parents 1276b90 + b83d6cc commit 8d2a23a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ A Google Chrome extension used to modify the page default encoding for Google Ch
[Google Chrome Web Store](https://chrome.google.com/webstore/detail/oenllhgkiiljibhfagbfogdbchhdchml)

## History
### v0.4.3(2019/1/5)
1. 【修复】由于 Chrome 72(也许更早)开始支持 Network Service,导致编码修改失败的问题

### v0.4.2(2018/2/24)
1. 【修复】如果网站没有提供 Content-Type,则应该使用 text/plain 作为默认 Content-Type 而不是 text/html(GitHub Issue:[#5](https://github.com/jinliming2/Chrome-Charset/issues/5)

Expand Down
6 changes: 5 additions & 1 deletion j/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const html_special_chars = (html) => html.replace(/&/g, '>')
.replace(/"/g, '"')
.replace(/\r\n?|\n/g, '<br>');

const options = ['responseHeaders', 'blocking'];
if(chrome.webRequest.OnBeforeSendHeadersOptions.hasOwnProperty('EXTRA_HEADERS')) {
options.push('extraHeaders');
}
chrome.webRequest.onHeadersReceived.addListener((details) => {
if(localStorage.getItem('tab' + details.tabId)) {
let i;
Expand Down Expand Up @@ -46,7 +50,7 @@ chrome.webRequest.onHeadersReceived.addListener((details) => {
}
}
return {responseHeaders: details.responseHeaders};
}, {urls: ["<all_urls>"]}, ["responseHeaders", "blocking"]);
}, {urls: ["<all_urls>"]}, options);

chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if(tab.url.startsWith('file://') && changeInfo.status === 'complete' && localStorage.getItem('tab' + tabId)) {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_appName__",
"version": "0.4.2",
"version": "0.4.3",
"default_locale": "en",
"description": "__MSG_appDescription__",
"icons": {
Expand Down

0 comments on commit 8d2a23a

Please sign in to comment.