Running code in a browser

  • Hi,
    How do I get to the code of Notpad++ in order to change the the cofigeration to allow Firefox and Chrome to run the code in their browsers?

  • You don’t need to change the code. If you have an HTML file (or some other web source files, but not others) open in recent Notepad++, go to View > View Current File In…, and pick the browser.

    In a future version (presumably whatever comes after v7.8.1, because issue#5903 was incorporated into codebase on Nov 1), it won’t just be “some other web source files, but not others”, it should be “any file type you want”.

    If you want a workaround for other formats (like .php or .asp or .txt), or if you have an older Notepad++ that doesn’t have View > View current file in… at all, then edit your %appdata%\shortcuts.xml file, as described in my Oct 29, 2019, 11:50 AM post. If your shortcuts.xml doesn’t currently have the <!-- ... --> comment marks to delete, just copy the five lines of XML <Command ...> items from that post and paste into the <UserDefinedCommands> section of the shortcuts.xml. After making the change, exit Notepad++ and re-run, and Run > Launch in … entries should exist and work for you.

  • @Terry-Shaw A small addition to the above)))
    Edit your shortcuts.xml file
    If this browser is installed on your operating system:

            <Command name="Launch in Firefox" Ctrl="no" Alt="no" Shift="no" Key="0">firefox &quot;$(FULL_CURRENT_PATH)&quot;</Command>

    If this browser is not installed on your operating system (portable version), then you need to specify the full path to the executable browser file:

            <Command name="Launch in Slimjet" Ctrl="no" Alt="no" Shift="no" Key="0">&quot;C:\Users\Uzeer\Downloads\sjt7z_x64\Slimjet\slimjet.exe&quot; &quot;$(FULL_CURRENT_PATH)&quot;</Command>

  • Hello, @Terry-Shaw

    Follow these steps to run code in a browser:

    Step 1:- The run menu by going to the %AppData%\Notepad++ directory.
    Step 2:- Edit the shortcuts.xml file.

    <Command name="Launch in Chrome" Ctrl="yes" Alt="yes" Shift="yes" Key="82">chrome &quot;$(FULL_CURRENT_PATH)&quot;</Command>

    That’s what it reads by default.

    <Command name="Launch in Chrome" Ctrl="yes" Alt="yes" Shift="yes" Key="82">%LocalAppData%\Google\Chrome\Application\Chrome.exe &quot;$(FULL_CURRENT_PATH)&quot;</Command>

    That’s what it could read.

    Step 3:- Type this into the run command box:

    %LocalAppData%\Google\Chrome\Application\Chrome.exe "$(FULL_CURRENT_PATH)"

    NOTE :- if you download the latest version (5.7?), the Run menu has four different “Launch in browser” menu item(IE, Firefox, Chrome, and Safari).

    I hope above information will be useful for you.

    Thank you.

Log in to reply