Force firefox to use spellcheck with a certain site
My FF spellcheck works just fine, for almost all sites. But there is one site in particular (requires a login; it is a Moodle learning management system online class page) that must tell my browser not to use spellcheck on it.
Is there a script or about:config command I can use, to get FF to ignore this request, and give me spellcheck?
所有回复 (8)
cor-el said
Does either of these JavaScript codes work in the Web Console or as a bookmarklet?javascript:void(document.querySelector(".mceContentBody").setAttribute("spellcheck", "true"));javascript:void(document.querySelector("[contenteditable=\"true\"]").setAttribute("spellcheck", "true"));
I don't know how to make a bookmarklet.
As far as the console goes--I opened the inspector, clicked on the Console button, and then pasted both bits of code below. Both times, I got an error message: TypeError: document.querySelector(...) is null
I don't know if I'm doing something wrong, or not.
It is possible that the actual editor is in a iframe.
What is the unique selector of the text edit area (this is one of the items in the right-click context menu)?
cor-el said
It is possible that the actual editor is in a iframe. What is the unique selector of the text edit area (this is one of the items in the right-click context menu)?
I searched in the INspector for uniqueSelector and found nothing. It gave me no results---if this is what you wanted me to do. Sorry a bit over my head. When I simply right-clicked, either inside the text area or outside of it, I found nothing like "unique selector" to choose.
You find this item in the right-click context menu of an element in the left pane of the Inspector just a few lines below "Edit As HTML".
- "Edit As HTML"
- "Copy Inner HTML"
- "Copy Outer HTML"
- "Copy Unique Selector"
I think I know what you wanted me to do. After clicking in the text field, I looked down to the Inspector, adn right clicked on the line of text that was selected (had a blue bar).
Now there was no "Copy Unique selector" option right under Edit as HTML. I am on FF nightly (don't know if that has anythign to do with it). What I saw was a Copy option, and an arrow that gave one option as CSS Selector. I clicked on that. I then pasted what you see below:
#fitem_id_subject
Is this the information you were looking for?
由cor-el于
Yes, that is to one in the current Nightly build: Copy > CSS Selector
You can use such a selector in querySelector()
elm=document.querySelector("#fitem_id_subject");
If that element has the spellcheck attribute then this JavaScript code should set it to true:
javascript:(function(){elm=document.querySelector("#fitem_id_subject");elm.setAttribute("spellcheck", "true"));})()
A bookmarklet is a bookmark that has JavaScript code instead of the URL of a website in its location field.
If you know some basic JavaScript then you can make all kind of changes to a web page.
I found the location of that fitem ID. It didn't have anything about spellcheck. I copies the "OuterHTML" and this is what it had:
At any rate, I did make a bookmarklet out of that code anyways, but it didn't work--on text I had already typed in, or on text that I typed after I hit that bookmarklet.
You need to find the selector of the text editor area that has the spellcheck attribute if you want to modify this attribute and use that as parameter in the document.querySelector() function.
Firefox doesn't enable the spell check on single line input fields by default. You need to set layout.spellcheckDefault to 2 on the about:config page. See also: