Try to have Cursor open a local index file in the built-in or remote controlled Chrome instance and the browser_navigate tool will reject it (probably due to not starting with http/https if I had to guess.)
This is a legitimate use case for single file html development, don’t always need a running server or livereload/HMR may be injected into the bundle loaded by the html file without a running html server.
Steps to Reproduce
Create a local index file and try to open it via typical file:// protocol. The easiest way to get this value is to double click to open it in Chrome first and then copy the local url. Enable either the built-in browser or Google Chrome in the agent browser setting and then instruct the agent to load that file URL. It won’t work.
Expected Behavior
It works.
Operating System
MacOS
Current Cursor Version (Menu → About Cursor → Copy)
Wish you’d fix this and it’s in Windows just as well. Browsers have been running local files forever, so it’s quite unusual.
An interim fix is to use Python’s built-in http.server (thanks to this “how to” discussion), by running:
python3 -m http.server
Or in Windows:
python.exe -m http.server
This will serve http://127.0.0.1:8080, and you’ll be able to open any local file using http://127.0.0.1:8080/[local_path] by just modifying [local_path].
This seems to be fixed! Just right click the HTML file and choose Open in Browser.
Please mark this as Solved.
If you like a live preview rather having to click refresh after every change, there’s a free Microsoft Live Preview extension that already employs a local server. It adds a right click option called “Show Preview” and auto splits it (i.e. preview runs to the right of its source file).
Thanks for the update and the tip about Live Preview. It’s a helpful workaround for users who need auto refresh.
Quick clarification: native file:// support in the agent browser tool wasn’t added. What works via right click Open in Browser and Show Preview opens the file in the system or built-in browser separately from the agent browser tool, which covers the main use case for most users.
I’ll mark this as resolved since the workaround works for you. If it’s important that the agent itself can navigate file:// URLs, please start a new thread with a specific scenario.