[Qgis-user] action to open an HTML file with arguments
Stephen Sacks
ssacks456 at gmail.com
Sun Sep 10 09:33:16 PDT 2023
Adam -
Thanks for your sage advice. Prepending file:// solves my problem
when the target HTML file is on my desktop hard drive. The arguments
are sent and received correctly.
I still have what turns out to be an unimportant problem when the
target HTML file is on the web (I use a free web host, InfinityFree):
my browser (Chrome) prepends the sending file's URL and then I get
error 403 page not found.
This turns out to be unimportant because it doesn't occur in
QGIS: my action
correctly sends arguments to the target HTML on my web site.
Many thanks for your help.
Steve
==================================
On 9/9/2023 7:17 AM, Adam Nielsen wrote:
>> 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 afile:// 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20230910/650575b3/attachment.htm>
More information about the QGIS-User
mailing list