Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

install google-chrome

sudo dpkg --install google-chrome-stable_current_amd64.deb

each time I run chrome, it ask me to set chrome as the default web browser. enter image description here


and I try to fix it in Settings enter image description here


or even uninstalled iceweasel, i still can't set chrome as my default browser.

please help. Thanks in advance.


edit:

I tried Mr. terdon suggested, but still got the same problem.

here is chrome.desktop

~$ cat /usr/share/applications/chrome.desktop

Name=Google Chrome
Terminal=false
Icon=google-chrome
Type=Application
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;
X-Ayatana-Desktop-Shortcuts=NewWindow;NewIncognito
Exec=/usr/bin/google-chrome %U

here is mimeapps.list

~$ cat .local/share/applications/mimeapps.list

[Default Applications]
text/html=google-chrome.desktop
x-scheme-handler/http=google-chrome.desktop
x-scheme-handler/https=google-chrome.desktop
x-scheme-handler/about=google-chrome.desktop
x-scheme-handler/unknown=google-chrome.desktop
share|improve this question
    
Is that setting reflected in your Preferences file? Maybe chrome doesn't have permission to write it to that file? Check find ~/.config/ -name 'Preferences' -exec grep "default_browser" "{}" \; –  Nate from Kalamazoo Jun 26 '13 at 15:16
    
@NatefromKalamazoo Thanks for advice. Your command got: find: missing argument to '-exec' then I tried find ~/.config/ -name 'Preference' | grep "default_browser" but got nothing. –  Teifi Jun 27 '13 at 13:23
    
You didn't happen to include the dash after the semicolon and before my name, did you? Please try this alone first: find ~/.config/ -name 'Preferences' and if that finds one or more files, search the resulting file with grep like so: grep "default_browser" the-filename-you-found –  Nate from Kalamazoo Jun 27 '13 at 15:05
    
@NatefromKalamazoo No, I didn't include the dash. as you suggested cd ~/.config/ find -name Preferences got ./google-chrome/Default/Preferences. Sorry, my fault I missed s in 'Preferences` –  Teifi Jun 27 '13 at 22:23
    
What happens when you search for default_browser using grep? grep "default_browser" ./google-chrome/Default/Preferences –  Nate from Kalamazoo Jun 28 '13 at 18:28

2 Answers 2

Default applications are defined in the file ~/.local/share/applications/mimeapps.list. Open the file in your favorite text editor and change

x-scheme-handler/http=firefox.desktop
x-scheme-handler/https=firefox.desktop

to

x-scheme-handler/http=chrome.desktop
x-scheme-handler/https=chrome.desktop

That should work as long as you have chrome.desktop in /usr/share/applications/.


UPDATE:

If you don't have a chrome.desktop file in /usr/share/applications/ just create one with these lines:

Name=Google Chrome
Terminal=false
Icon=google-chrome
Type=Application
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;
X-Ayatana-Desktop-Shortcuts=NewWindow;NewIncognito
Exec=/opt/google/chrome/google-chrome %U

Change /opt/google/chrome/google-chrometo whatever is returned by which google-chrome.

share|improve this answer
    
Thanks, i'll have a try later. –  Teifi Jun 27 '13 at 0:42
    
There's no chrome.desktop in /usr/share/applications/, also not in /opt/google/ I use find -name chrome.desktop at /opt/google/ but find nothing –  Teifi Jun 27 '13 at 12:41
    
@Teifi it won't be in /opt/google/, try locate chrome.desktop. –  terdon Jun 27 '13 at 12:50
    
Sorry sir. there must be some problem in my system. locate chrome.desktop got nothing. –  Teifi Jun 27 '13 at 12:57
    
@Teifi, see updated answer –  terdon Jun 27 '13 at 13:06

The default is /usr/share/applications/mimeinfo.cache, he was read into /usr/share/applications/*.desktop

grep -R x-scheme-handler/http /usr/share/applications/*.desktop

/usr/share/applications/chromium.desktop:MimeType=text/html;text/xml;application/xhtml+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; /usr/share/applications/firefox.desktop:MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;

My approach is to modify the user's ~/.local/share/applications/mimeinfo.cache will x-scheme-handler/http (http protocol)、x-scheme-handler/https (https protocol) specified by chrome.desktop open.

save this codes to foo ; and sh ./foo

#!/bin/bash
cd ~/.local/share/applications/
sed -i '/http=\|https=/d' mimeinfo.cache
cat >>mimeinfo.cache<<EOF
x-scheme-handler/http=chrome.desktop;
x-scheme-handler/https=chrome.desktop;
EOF
share|improve this answer
    
Some explanation would be nice... –  David Dec 4 '13 at 19:50
    
I try to use google translator to explain –  hepha Dec 6 '13 at 7:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.