How do I pass a parameter to a locally store webpage from the context (right click) menu?
-
I’m trying to get a locally stored html file to run from the context menu.
moderator deleted confusing version, because it makes this topic harder to read; continue to the reply below for correct formatting of the original question
-
@David-Fox Apologies Something went wrong with the formatting, & I’m unable to edit.
I’m trying to get a locally stored html file to run from the context menu.
<Command name="OSM History" Ctrl="no" Alt="yes" Shift="no" Key="114">file:///E:/dwgs/Json/OSM_tag_history/index.html?$(CURRENT_WORD)</Command>
Current word =
node/6135938647
It will load index.html but not display the data expected for that parameter.
I added a couple of checks:
console.log("Search params:", window.location.search); console.log("Full href:", window.location.href);
They return:
Search params: <empty string> index.html:38:9 Full href: file:///E:/dwgs/Json/OSM_Tag_History/index.html index.html:39:9
Pasting this into the browser’s URL bar the data is received & loaded as expected: file:///E:/dwgs/Json/OSM_Tag_History/index.html?node/6135938647
So the fact it’s a local
file:///
appears to be why it’s failing?
Any ideas for a fix? -
@David-Fox said in How do I pass a parameter to a locally store webpage from the context (right click) menu?:
I’m trying to get a locally stored html file to run from the context menu.
Commands that are in the run menu also need to be runnable from the cmd.exe window (except with the full value pasted in – and, in the case of URLs, also must prefix the command with
START
).If you try to execute your command with the
START
prefix, in cmd.exe, you will see it does the same thing:START file:///E:/dwgs/Json/OSM_Tag_History/index.html?node/6135938647
that is, it drops the query parameters. It’s a “feature” of Windows (and the shell execute or similar syntax), and not something that’s Notepad++'s fault.
Pasting this into the browser’s URL bar the data is received & loaded
You might then try sending the
file:///E:/dwgs/Json/OSM_tag_history/index.html?$(CURRENT_WORD)
as a command-line parameter to your browser’s executable (using correct syntax), insead of relying on Windows cmd interpreter. Maybe something likemybrowser.exe file:///E:/dwgs/Json/OSM_tag_history/index.html?$(CURRENT_WORD)