From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-protocol: Add void() to bookmarklets
Date: Tue, 24 Dec 2024 21:14:17 +0700 [thread overview]
Message-ID: <vkefjs$1gl$1@ciao.gmane.io> (raw)
In-Reply-To: <87frmf99dq.fsf@localhost>
On 22/12/2024 19:42, Ihor Radchenko wrote:
> Max Nikulin writes:
>
>> -javascript:location.href='org-protocol://store-link?' +
>> - new URLSearchParams({url:location.href, title:document.title});
>> +javascript:void(location.href='org-protocol://store-link?' +
>> + new URLSearchParams({url:location.href, title:document.title}));
>> #+end_example
>
> Another variant from reddit is
>
> javascript:location.href='org-protocol://store-link?'+new URLSearchParams({url:location.href, title:document.title}); void(0);
If you think that ";void(0)" variant is less prone to errors then I may
update my patch. I have no idea if balanced void(...) parenthesis around
the whole expressions would cause more user mistakes. Otherwise both
variants are equivalent.
> https://old.reddit.com/r/emacs/comments/1h7ws1i/the_orgprotocol_bookmarklet_opens_a_blank_page/
I can not figure out why it did not work without user's
~/.local/share/applications/org-protocol.org. The only guess is that
firefox might be confused by complex Exec entry in emacsclient.desktop.
So I am curious if /usr/share/applications/emacsclient.desktop has
org-protocol in MimeType (Emacs >= 29.2) and if a copy of
emacsclient.desktop in ~/.local/share/application changes behavior in
the absence of custom org-protocol.desktop.
I have never used bookmarklets, so I am unsure concerning behavior in
earlier Firefox versions. Unfortunately security-related bugs are
non-public yet, so I have not idea what has been changed. (I am not
motivated to search for related commits.)
> Also, will the change work in older browsers? In non-Firefox?
<https://en.wikipedia.org/wiki/Bookmarklet>
page has a citation that "void" appeared in JavaScript namely for
bookmarklets and it happened in the previous century.
";undefined" instead of ";void(0)" suffix might be an issue in old
browsers since "undefined" was added to JS ~10 years ago. I do not
expect any problem with "void" despite I have used it only in workaround
for a browser bug.
>> Should ORG-NEWS be updated as well?
>
> Yes, I think. In announcement section.
> This is one of the cases when we want people to consider changing their
> usual configs.
My idea is to fix existing examples in place, perhaps with a small
remark on update reason.
Maybe experienced users of bookmarklets are aware of the "void" trick
and provided examples were enough for them.
I consider the change as a minor fix that does not deserves loud
announcement, especially taking into account that browsers discourages
protocol handlers launched on behalf of web pages nowadays.
next prev parent reply other threads:[~2024-12-24 15:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-12 8:12 [BUG] Org-protocol bookmarklets in Firefox behaving badly after recent upgrade [9.6.15 (release_9.6.15 @ /usr/share/emacs/29.4/lisp/org/)] Rehan Deen
2024-12-12 10:34 ` Max Nikulin
2024-12-12 14:14 ` Max Nikulin
2024-12-12 18:47 ` Rehan Deen
2024-12-13 11:09 ` Max Nikulin
2024-12-16 16:01 ` [PATCH] org-protocol: Add void() to bookmarklets Max Nikulin
2024-12-16 16:40 ` Max Nikulin
2024-12-22 12:43 ` Ihor Radchenko
2024-12-22 12:42 ` Ihor Radchenko
2024-12-24 14:14 ` Max Nikulin [this message]
2024-12-24 14:23 ` Ihor Radchenko
[not found] ` <875xnp6qin.fsf@gmail.com>
2024-12-12 17:15 ` [BUG] Org-protocol bookmarklets in Firefox behaving badly after recent upgrade [9.6.15 (release_9.6.15 @ /usr/share/emacs/29.4/lisp/org/)] Rehan Deen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='vkefjs$1gl$1@ciao.gmane.io' \
--to=manikulin@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).