[Qgis-user] action to open an HTML file with arguments

Adam Nielsen a.nielsen at shikadi.net
Sat Sep 9 04:17:01 PDT 2023


> then the web page opens.  But if the "Action Text"  is
>               C:/temp/receiveParms.html?arg1=C&arg2=D
> the web page fails to open.

Probably because a question mark isn't a valid filename character so
it gets escaped as %3F, and then the file doesn't exist with %3F in the
filename so you get the error.  The question mark isn't a traditional
URL separator, it's passed to the server unchanged and the server may
choose to only look at the part of the filename before the question
mark but it doesn't have to.  When there is no server and it's just on
your filesystem the actual behaviour is probably browser-specific.

> I wrote sendParms.html which includes the following line:
> <a href="C:\temp\receiveParms.html?arg1=abc&arg2=xyz">

This isn't a valid URL because it doesn't contain a protocol.  It would
have to be a file:// URL which contains its own rules and semantics.

You could try using the hash (#) symbol instead of the question mark,
as the browser does not send the part after the hash to the server, so
it should work with local files as well (just remember to use the
file:// URL scheme to avoid unpredictable behaviour).

You can pick out the part after the hash in the HTML by using
Javascript code.

Cheers,
Adam.


More information about the QGIS-User mailing list