Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
454 views
in Q2A Core by
edited by

I could not find a function to get the current browser, is there any implemented?

My problem: Since my ckeditor is flickering in IE with the first button that is set - I could not find the source of the problem - I have to insert a pseudo element at first (that can flicker). For this I have to check for IE in qa-wysiwyg-editor.php.

1 Answer

+1 vote
by
edited by
 
Best answer

No, you'll have to use the standard PHP $_SERVER['HTTP_USER_AGENT']

by
thanks. So I used a browser switch in qa-wysiwyg-editor.php:

    // detect IE for workaround flickering, inserts pseudo element
    if( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) {
        $qa_content['script_lines'][]=array(
            "qa_wysiwyg_editor_config={toolbar:[".
            // first element is pseudo element for flickering bug of IE
            "['-'],".
            "['Image'],".
            ...
it works.
by
edited by
Little Addition:
   if( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) { ...

could lead to "PHP Notice:  Undefined index:  HTTP_USER_AGENT"

So you better include a check if set:
if( isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) {

or you use php's get_browser() function.
by
in this way are you able to switch editor depending on the user browser?
...