can an addon MOVE THE CURSOR?
can an addon move the cursor?
Réiteach roghnaithe
My thought is that as long as Firefox's security is not breached, neither websites nor add-ons can move the mouse pointer. That would need to be done from outside Firefox by sending code directly to the system.
Read this answer in context 👍 1All Replies (8)
Hi Joe, an add-on can inject a script into a page, so anything a page can do with a script, an add-on probably can do.
What kind of problem are you having with your cursor?
One thing that many users encounter is that Firefox changes to "caret browsing" mode where an insertion bar appears in the text (not just in form text boxes). This can be turned on and off using the F7 function key, and you can always check the Options page:
- Windows: "3-bar" menu button (or Tools menu) > Options
- Mac: "3-bar" menu button (or Firefox menu) > Preferences
- Linux: "3-bar" menu button (or Edit menu) > Preferences
- Any system: type or paste about:preferences into the address bar and press Enter/Return to load it
In the search box at the top of the page, type cursor and Firefox should filter the page.
If the box is checked for Always use the cursor keys to navigate within pages, uncheck it to turn off caret browsing.
I have found that sometimes, the mouse pad sends a signal even when you don't use it. Open the pad settings and select to disable the pad when the mouse is detected.
the answer should be very simple. Yes or No.
Can an add-on, or thus a script since an add-on just runs a script, move the cursor?
Forget about why I ask or the mouse pad or anything else.
Hi Joe, do you mean the insertion point -- the bar that flashes in form text boxes where you are typing -- or the mouse pointer (usually an arrow)?
A web page script can move the insertion point by selecting text and then collapsing the selection to the start or end, so a script injected by an extension should be able to do that, too.
I don't know whether either a web page script or an extension can move the mouse pointer.
If you have questions about developing an extension, you can seek support on the Add-ons forum here:
sorry. i guess I was not correct. I mean the "mouse pointer".
Thank you for clarifying that, since it could mean either one. Two things from a web search:
(1) Pointer Lock
Scripts in pages can take some control of your mouse pointer, per this demo:
https://mdn.github.io/dom-examples/pointer-lock/
Firefox should pop down with a notice informing you that you can press the Esc key to cancel control. (Similar to the message about using Esc to exit full screen videos.)
If you want to completely disable that feature:
(a) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.
(b) In the search box in the page, type or paste dom.pointer-lock.enabled and pause while the list is filtered
(c) Double-click the preference value (or use the toggle button on the right end of the row) to switch it from true to false
More info on about:config: Configuration Editor for Firefox.
(2) Simulating the mouse pointer with an image
I found this article, but I haven't tried it myself: https://www.geeksforgeeks.org/how-to-move-mouse-pointer-to-a-specific-position-using-javascript/
thanks jscher2000 for your reply. That comes close. but, it looks like this API--which I found very interesting--does not actually have anything to do with moving the cursor (and it does call it cursor, not mouse pointer). What "movement" that is done is just an "interpretation" of the mouse movement. I want to move the cursor (mouse pointer) programmatically--i.e. without the use of the mouse. (Well, actually I don't want to do this. I'm just curious, at this stage: can it be done?)
It seems the answer is NO.
Réiteach Roghnaithe
My thought is that as long as Firefox's security is not breached, neither websites nor add-ons can move the mouse pointer. That would need to be done from outside Firefox by sending code directly to the system.