Skip to content

Launching CUSTOM browser (and not Windows' default) - Updated to ComfyUI 0.33.1 #11709

Description

@gershu-ar

Feature Idea

🕐 The Situation
ComfyUI portable opens Windows' default browser after console finishes it's work. In my case, I use several browsers (depending on the task), and I did not want to use the default one. I did the math and code and it has been working like a charm since v0.6.0 up to v0.33.1 so why not share it and perhaps add it to ComfyUI settings?

To-do: present the code properly with UI modification scheme and all the goodies to be inducted, hopefully, in a production version not needing to rely on annoying manual code modifications for each new version.

🖥️ The Code -> (Shortcut to modified file -> Gist)

Code is for anyone wanting to test/apply this to their installs; even if this never gets officially implemented, it serves as a future reference for anyone facing the same dilemma and is searching for a reliable temporary quick fix.

NOTICE: Following code is developed around Chromium-based browsers (Google Chrome, Brave, Opera, Edge, etc). It might run or not run with other browsers; let me know in a comment if you are having issues running code with a non Chromium-based browser.

All coding is done on main.py only (located at "...\ComfyUI_windows_portable\ComfyUI" directory)

1) Add import
Open main.py and add import subprocess at the top.

...
import sys
import subprocess # Add this line
...

2) Modify Logic
Locate "if args.auto_launch:" and replace the code up to "call_on_start = startup_server".
Should end up like this:

    ...
    if args.quick_test_for_ci:
        exit(0)

    os.makedirs(folder_paths.get_temp_directory(), exist_ok=True)
    call_on_start = None
        


    #Customer browser start
    if args.auto_launch:
        def startup_server(scheme, address, port):
            if os.name == 'nt' and address == '0.0.0.0':
                address = '127.0.0.1'
            if ':' in address:
                address = "[{}]".format(address)

            url = f"{scheme}://{address}:{port}"
            
            # ----------------- SETTINGS -----------------
            # Set the full path to the browser you want to use.
            custom_browser = r"C:\Users\<YOUR WINDOWS USERNAME>\AppData\Local\Chromium\Application\chrome.exe"
            
            # Specify which profile to use by FOLDER name, not by display name.
            # To check what folder corresponds to your profile,
            # look for the last directory name at "Profile path" on the chrome://version/ information screen.
            # For example: If it reads "...\Local\Chromium\User Data\Profile 2" then set profile_name to "Profile 2".
            # "Default" sets to use main profile of any Chromium-based browser.
            profile_name = "Default"  
            # ---------------------------------------------

            cmd = [custom_browser]
            if profile_name:
                cmd.append(f"--profile-directory={profile_name}")
            cmd.append(url)

            try:
                subprocess.Popen(cmd)
            except Exception:
                import webbrowser
                webbrowser.open(url)

        call_on_start = startup_server
    #Customer browser end



    async def start_all():
        await prompt_server.setup()
        await run(prompt_server, address=args.listen, port=args.port, verbose=not args.dont_print_server, call_on_start=call_on_start)
    ...

Remember to abide by Python's indentation rules, they are very strict.

3) Set "custom_browser" and "profile_name" variables
By default "custom_browser" and "profile_name" are set to use Google Chrome with default profile, edit those variables to your needs.

That's it. Run ComfyUI portable as you would normally do.

💾 Bookmark -> Gist
Found this useful? The Gist (official main.py with injected custom browser code) for your delight is right here
Star/Bookmark/write down URL of the thing, I update the code each new version, mostly same day releases.

🔆 Tip: Browser profiles
On the profile variable ("profile_name") you can also specify a browser's profile to open directly along the custom browser setting.

Example for Google Chrome/Ungoogled Chrome
With default install dir.

custom_browser = r"C:\Program Files\Google\Chrome\Application\chrome.exe"
profile_name = "Default"  

To verify what profile you're in, just type "chrome://version/" on the browser (press ENTER) and pay attention to last folder on "Profile Path": the last directory name of the path is what goes into "profile_name".

For example, if it reads:

C:\Users\<YOU>\AppData\Local\Chromium\User Data\Profile 3

Then the variable should be set as such:

profile_name = "Profile 3"  

Voilá.

It works like warm butter.

Keep in mind most Chromium-based browsers use the same settings and switches, but some don't or they are bugged or whatever.

For example, as for Brave Browser (v1.91.175 (Jun 17, 2026)), loading profiles does not work (tried EVERYTHING without success), in or out Comfy; loading profiles from a switch just do not work.

👍 Thank you for reading and thank you for supporting ComfyUI!.

About and updates

Updated on 14/AGO/2026
Tested with ComfyUI portable version v0.33.1 for Windows.

WARNING: Be advised the above code does not work with older ComfyUI versions, the custom browser code gets periodically updated to keep track of ComfyUI's own code implementations.

⁉️ If you have any questions/comments, go for it!
⛔ If the above code ceases to work, please, post here and let me know so I can keep it up to date.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureA new feature to add to ComfyUI.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions