Pages

Tuesday, July 16, 2013

How to turn openWYSIWYG compatible with Google Chrome and Safari Browsers

Hi there,

Today I needed to turn the openWYSIWYG editor compatible with Google Chrome and Safari browsers. It is already compatible with Firefox and IE.

So, to turn it compatible with Chrome and Safari you only need edit the file: wysiwyg.js
In this file there is a method called: isBrowserCompatible

Current code:
isBrowserCompatible: function() {
        if ((navigator.userAgent.indexOf('Safari') != -1 ) 
             || !document.getElementById || !document.designMode) {
            return false;
        }
        return true;
    },

Removing the condition (navigator.userAgent.indexOf('Safari') != -1 ) from the if, that turns it compatible with Chrome and Safari.

isBrowserCompatible: function() {
        if (!document.getElementById || !document.designMode) {
            return false;
        }
        return true;
    },

Tested on:
Google Chrome Version 28.0.1500.71
Safari Version 6.0.5 (8536.30.1)
Firefox 22.0

3 comments:

  1. thanks alot maaaan. visit me at anomoz.com

    ReplyDelete
  2. This could open the WYSIWYG in Chrome but when trying to access some functionalities as for example, insertHTML the problem get back again.

    ReplyDelete