Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
2.1k views
in Q2A Core by
As many of us know ckeditor does not get activated in some of the android devices, now I wanna inform user by a single javascript code or something that  "the wysiwyg editor you are waiting to download is not availabe",

how can i do that in qa-wysiwyg-editor.php ?
Q2A version: qa 1.7
by
What is the issue with Android? Is this an alternate browser (not the default) because CKeditor supposedly supports Chrome on Android fine. Looks like there is a potential workaround here: http://ckeditor.com/support/faq/features#question10
If that works let me know and I'll include it in the next Q2A.
by
No, I am using qa1.7 on chrome on samung note 4 and also tested it on google nexus chrome. the ckEditor does not get loaded at all. it is just a blank text box! So what is your suggestion to detect this situation?


Also I tested the CKEDITOR.env.isCompatible to true. It again works on few of the devices not all. So dealing with the situation ckEditor is not loaded is inevitable and we have to fined a way to detect it

1 Answer

0 votes
by

From the tests I've made I noticed the plugin gets loaded, even in those devices. The thing is the plugin itself decides not to proceed. So checking if it is loaded is not enough.

So you tried forcing the CKEDITOR.env.isCompatible variable to true but, as expected, it will not always work. In order to know if it will work, the best approach I can think of is to test that variable in your JS code. That means, first let the plugin load and perform whatever setup it needs. Then just:

if (!CKEDITOR.env.isCompatible) {
    // Load Plan B editor
}
 
Note this is JS code. The quick and dirty test can be performed from chrome's console after loading the plugin, just execute CKEDITOR.env.isCompatible and the console will log the variable's value.
 
I haven't tested this one but I'm pretty sure it should work :)
by
The thing is, like you mentioned, CKEDITOR.env.isCompatible has a value only if the plugin is loaded (without plugin loaded, CKEDITOR.env.isCompatible has no value and cannot be tested)

So if we force the CKEDITOR.env.isCompatible to true then testing it would be pointless!
If however we cannot CKEDITOR.env.isCompatible to true, then its unknown variable!

My point is, "in practice"
 if (!CKEDITOR.env.isCompatible) {
    // Load Plan B editor
}

is not gonna work all then time

this might work
 if plugin is loaded && CKEDITOR.env.isCompatible == true
then we are good, otherwise plan B
by
As I said in my answer, "the plugin gets loaded, even in those devices". So if your concern is only Android then you don't need to check if the plugin is loaded or not because it is. I have already checked this. If you still want to check if the plugin is loaded before checking its compatibility, then just add:

if (typeof window.CKEDITOR === 'undefined' || !CKEDITOR.env.isCompatible) {
    // Plan B!
}
...