Possible to make Opera@USB as default browser in Windows 7?

Ask other users about problems encountered with portable apps or help by posting solutions to existing problems.
Post Reply
Message
Author
godslayer
Posts: 4
Joined: Sat Mar 06, 2010 9:14 pm

Possible to make Opera@USB as default browser in Windows 7?

#1 Post by godslayer »

Currently using it via a ramdisk but programs wont launch when click on hyperlink.

Hope to have some advice.

Using Windows 7 "Default Programs" association via protocol not possible as its not listed.


Thanks!

ashghost
Posts: 384
Joined: Wed Feb 06, 2008 2:55 pm
Location: South Carolina

Re: Possible to make Opera@USB as default browser in Windows 7?

#2 Post by ashghost »

I thought I'd find a workaround for you, but instead I found the solution!

I have a program called Browser Chooser (http://www.portablefreeware.com/forums/ ... f=4&t=5400) that will set itself as your default browser. It then brings up a window with a configurable list of icons for you to click to choose a browser. You can also type the number of the icon or the first letter of the Browser Chooser entry to launch that browser. I was thinking you could set one of these to Opera, and then it'd just be an extra click or keypress.

However, once Browser Chooser was successful at registering itself, I realized that I could find those registry entries. I exported them to a .reg file, edited them to point at my portable Opera instead, and it worked!

Here are the contents of my .reg file:

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"Opera"="Software\\\\Opera\\\\Capabilities"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera\shell\open\command]
""="F:\\Apps\\Opera10\\Opera.exe %1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera\DefaultIcon]
""="F:\\Apps\\Opera10\\Opera.exe,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera]
""="Opera HTML"
Just copy and past the above text into Notepad, replace my path to Opera with your path to Opera@USB, then save it with a .reg extension. Double click on that file to import the keys to your registry and Opera@USB will become your default browser. You can, of course, also change the name from "Opera" to "Opera@USB" in the first entry, if you care how it shows up in Win7's "Default Applications" applet.
Last edited by ashghost on Sun Mar 07, 2010 8:55 am, edited 1 time in total.

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: Possible to make Opera@USB as default browser in Windows 7?

#3 Post by guinness »

I used RegFromApp went to the Opera and used the official route of making the default browser (Tools >> Preferences >> Advanced >> Programs >> Details chose the protocols HTTP, HTTPS, FTP, HTML, XML, TORRENTS & FTP) this is what was created.

Change C:\\Opera\\opera.exe\ to your location e.g. F:\\Programs\\Opera\\Opera.exe\
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera.HTML\DefaultIcon]
""="C:\\Opera\\opera.exe,1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera.HTML\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera.Image\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\HTTP\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\https\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ftp\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""
Last edited by guinness on Mon May 31, 2010 12:59 pm, edited 1 time in total.

godslayer
Posts: 4
Joined: Sat Mar 06, 2010 9:14 pm

Re: Possible to make Opera@USB as default browser in Windows 7?

#4 Post by godslayer »

Hi,

Thanks for the help. Unfortunately it doesn't work for me. Both methods.

1 improvement is that when for example I click on a hyperlink, it launches Opera@USB.

Thing is, it only open up the SpeedDial page instead of going to the URL which I just clicked.

Any possible advice?

Thanks

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: Possible to make Opera@USB as default browser in Windows 7?

#5 Post by guinness »

Strange because it works on WinXP SP3! What system are you using 32bit or 64bit, did you register the program via the UI e.g. Tools >> Preferences etc. or the registry hacks we gave you? Do you have the latest version of Opera?

ashghost
Posts: 384
Joined: Wed Feb 06, 2008 2:55 pm
Location: South Carolina

Re: Possible to make Opera@USB as default browser in Windows 7?

#6 Post by ashghost »

You can't browse for a program to assign to a protocol in Windows 7 like you can for a file extension - you're presented with a list of known browsers only. That's why the registry hack is necessary, to let Windows know that the portable Opera is a browser.

Godslayer, I don't see why it wouldn't work for you, unless it's a problem with your Opera@USB versus my natively portable Opera (as of version 10, it's just as portable as Opera@USB (see this thread and the instructions on the recently updated Opera entry of the database. That doesn't seem very likely, since the executable files are now completely identical (I think it got a bit easier to maintain Opera@USB as of Opera 10.0 ;) ) . . .unless there's a problem because you're using a file named "opera@usb.exe"? Try renaming it to Opera.exe and adjust the registry values accordingly?

Are you sure you changed all the paths in my example correctly? I originally screwed it up slightly - some of the keys were named "BrowserChooserHTML". That didn't make a difference when I used it on my system, but I've fixed it, anyway.

Perhaps guinness's keys from XP are interfering? Perhaps you should make sure you delete those and try again?

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: Possible to make Opera@USB as default browser in Windows 7?

#7 Post by guinness »

If the application is named Opera@USB.exe it's PRE 10.50 because you can't name the Opera executable anymore.
You can't browse for a program to assign to a protocol in Windows 7 like you can for a file extension - you're presented with a list of known browsers only. That's why the registry hack is necessary, to let Windows know that the portable Opera is a browser.
I selected Opera as default in the Advanced Preferences section of Opera and it worked, I don't quite understand what you mean about your comment?

EDIT: I understand you were referring to the first post.

godslayer
Posts: 4
Joined: Sat Mar 06, 2010 9:14 pm

Re: Possible to make Opera@USB as default browser in Windows 7?

#8 Post by godslayer »

Sorry for the late response.

I am using Windows 7 Ultimate x64.

The methodology suggested I think works in XP only as prior before I post this topic, I had did some googling. All methods works when used in XP.

Just a short highlight, using Opera@USB while having the Opera Desktop version installed works. Hyperlinks gets launched by Opera@USB when clicked.

For now, I used back Firefox till I can fix this problem.

By the way, the exe is already named Opera.exe as per 10.50. I used Opera@USB to let others understand I am using the portable version


godslayer
Posts: 4
Joined: Sat Mar 06, 2010 9:14 pm

Re: Possible to make Opera@USB as default browser in Windows 7?

#10 Post by godslayer »

After much testing, I managed to get it to work by using Types.

Unfortunately the registry edits here didn't work.

Much thanks for the attempt to help. :)

dark79
Posts: 1
Joined: Sun May 30, 2010 10:44 am

Re: Possible to make Opera@USB as default browser in Windows 7?

#11 Post by dark79 »

godslayer wrote: 1 improvement is that when for example I click on a hyperlink, it launches Opera@USB.

Thing is, it only open up the SpeedDial page instead of going to the URL which I just clicked.
I'm also using Windows 7 x64 and what godslayer says is true. The Opera app is opened but the url value isn't passed to the browser so it doesn't open it. It can be fixed with one small edit to guiness's code.

Code: Select all

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera.HTML\DefaultIcon]
""="C:\\Opera\\opera.exe,1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera.HTML\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera.Image\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\HTTP\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\https\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ftp\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""
The %1 is needed otherwise it just opens the browser and doesn't open the link. Now it works perfectly for me :D

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: Possible to make Opera@USB as default browser in Windows 7?

#12 Post by guinness »

Thanks for the update, I completely missed this! Updated the post.

Hydaral
Posts: 194
Joined: Tue Mar 09, 2010 7:36 pm

Re: Possible to make Opera@USB as default browser in Windows 7?

#13 Post by Hydaral »

Here is what I use for my Opera file and protocol associations:

Code: Select all

@echo off

setlocal enabledelayedexpansion

set batdir=%~dp0

set assocprefix=Opera
set execfile=%batdir%opera.exe
set iconfile=%batdir%opera.exe


if ""%1""==""/?"" (

	echo.
	echo usage:
	echo.
	echo Remove associations: "%~nx0" ^rem
	echo.
	echo Add associations: "%~nx0" add
	echo.
	goto end

)

set option=%1

rem Set protocol associations
echo Removing current protocol associations...
reg delete HKCU\Software\Classes\HTTP /f
reg delete HKCU\Software\Classes\HTTPS /f
echo.
echo Done.
echo.

if not ""%option%""==""rem"" (
	echo Setting new protocol associations...
	reg add HKCU\Software\Classes\HTTP\shell\open\command /v "" /t REG_SZ /d "\"%execfile%\" \"%%1\"" /f
	reg add HKCU\Software\Classes\HTTP\DefaultIcon /v "" /t REG_SZ /d "%iconfile%,0" /f
	reg add HKCU\SOFTWARE\Classes\HTTP\shell\open\ddeexec /v "" /t REG_SZ /d ""
	reg add HKCU\SOFTWARE\Classes\HTTP\shell\open\ddeexec\Application /v "" /t REG_SZ /d ""
	reg add HKCU\SOFTWARE\Classes\HTTP\shell\open\ddeexec\Topic /v "" /t REG_SZ /d ""

	reg add HKCU\Software\Classes\HTTPS\shell\open\command /v "" /t REG_SZ /d "\"%execfile%\" \"%%1\"" /f
	reg add HKCU\Software\Classes\HTTPS\DefaultIcon /v "" /t REG_SZ /d "%iconfile%,0" /f
	reg add HKCU\SOFTWARE\Classes\HTTPS\shell\open\ddeexec /v "" /t REG_SZ /d ""
	reg add HKCU\SOFTWARE\Classes\HTTPS\shell\open\ddeexec\Application /v "" /t REG_SZ /d ""
	reg add HKCU\SOFTWARE\Classes\HTTPS\shell\open\ddeexec\Topic /v "" /t REG_SZ /d ""
	echo.
	echo Done.
	echo.
)


rem Fields: file extension, icon index, filetype (XXX File)
rem Use a period to separate fields, an underscore for spaces
for %%a in (html.1.HTML,htm.1.HTM,mht.1.MHT) do (

	set var=%%a
	set var=!var:.= !

	for /f "tokens=1,2,3" %%b in ('echo !var!') do (

		set ext=%%b
		set icon=%%c
		set type=%%d
		set type=!type:_= !

		echo Removing current !ext! associations...
		reg delete HKCU\Software\Classes\%assocprefix%.!ext! /f
		reg delete HKCU\Software\Classes\.!ext! /f
		echo.

		if not ""%option%""==""rem"" (

			echo Setting new !ext! associations...

			reg add HKCU\Software\Classes\.!ext! /v "" /t REG_SZ /d "%assocprefix%.!ext!" /f

			reg add HKCU\Software\Classes\%assocprefix%.!ext! /v "" /t REG_SZ /d "!type! File" /f
			reg add HKCU\Software\Classes\%assocprefix%.!ext!\shell\open\command /v "" /t REG_SZ /d "\"%execfile%\" \"%%1\"" /f
			reg add HKCU\Software\Classes\%assocprefix%.!ext!\DefaultIcon /v "" /t REG_SZ /d "%iconfile%,!icon!" /f

		)
		echo Done.
		echo.
		echo.
	)
)

:end
pause
Just copy and save this to a batch file and put it in the same directory where opera.exe is, then just double click on it. It will associate the HTTP and HTTPS protocols and HTML, HTM and MHT file extensions with Opera. To remove the associations, just run the batch file in a console, but append "rem" to the command, so you would have something like this:

Code: Select all

c:\>associate.bat rem
I use the HKEY_CURRENT_USER area so that the associations only apply to myself, not any other users on the computer, it also means the original associations in HKLM are untouched.

I use similar batch files for association for all my other portable apps, eg OpenOffice, Irfanview, etc. Let me know if you need it explained.

This works in XP, I have no idea if it works in Vista or Win7 though.

Hydaral
Posts: 194
Joined: Tue Mar 09, 2010 7:36 pm

Re: Possible to make Opera@USB as default browser in Windows 7?

#14 Post by Hydaral »

I just found a problem with the way Outlook handles the protocol links, it opens up a "Locate link browser" dialog. I have updated the code in my previous post to work around it.

User avatar
Magibon
Posts: 177
Joined: Thu Feb 24, 2011 4:24 pm

Re: Possible to make Opera@USB as default browser in Windows

#15 Post by Magibon »

dark79 wrote:
godslayer wrote: 1 improvement is that when for example I click on a hyperlink, it launches Opera@USB.

Thing is, it only open up the SpeedDial page instead of going to the URL which I just clicked.
I'm also using Windows 7 x64 and what godslayer says is true. The Opera app is opened but the url value isn't passed to the browser so it doesn't open it. It can be fixed with one small edit to guiness's code.

Code: Select all

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera.HTML\DefaultIcon]
""="C:\\Opera\\opera.exe,1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera.HTML\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Opera.Image\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\HTTP\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\https\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ftp\shell\open\command]
""="\"C:\\Opera\\opera.exe\" \"%1\""
The %1 is needed otherwise it just opens the browser and doesn't open the link. Now it works perfectly for me :D


Fantastic!
Thank you very much, this worked for me.

F.Y.I
If anyone is wondering how to associate Magnet Links.

Code: Select all

REGEDIT4 

[HKEY_CLASSES_ROOT\magnet]
@="URL:magnet Protocol"
"URL Protocol"="" 

[HKEY_CLASSES_ROOT\magnet\shell]

[HKEY_CLASSES_ROOT\magnet\shell\open]

[HKEY_CLASSES_ROOT\magnet\shell\open\command]
@="\"D:\\PortableApps\\uTorrentPortable\\uTorrentPortable.exe\" \"%1\""

Post Reply