Menu

#11 Fix for Chrome/Safari

open
nobody
None
5
2008-10-30
2008-10-30
jlewin
No

The following is a simple fix to enable CodePress for Chrome/Safari/WebKit. For a short term fix, extract the contents of the zip into your CodePress root folder and allow it to overwrite codepress.html. The fix is really two lines of code to make CodePress aware of WebKit useragents and a duplicated version of the Firefox "engine" as a starting point for WebKit. As people find bugs that need WebKit specific implementations, we can update engines/webkit.js accordingly. Let me know if there are questions or problems.

Below is a diff/patch of codepress.html in case you're interested:

diff codepress.html codepress.html
15c15
< else if(ua.match('KHTML')) engine = 'khtml';
---
> else if(ua.match('AppleWebKit')) engine = 'webkit';
30c30
< if(engine == "msie" || engine == "gecko") document.write('<body><pre> </pre></body>');
---
> if(engine == "msie" || engine == "gecko" || engine == "webkit") document.write('<body><pre> </pre></body>');
32d31
< // else if(engine == "khtml") document.write('<body> </body>');

Discussion

  • jlewin

    jlewin - 2008-10-30
     
  • jlewin

    jlewin - 2008-10-30

    See attached zip file...

     
  • Anonymous

    Anonymous - 2012-01-03

    first: Thanks! i needed this :-)

    second: at least in chrome 16 the webit.js will crash the javascript execution.
    in webkit.js find:

    // put code inside editor
    setCode : function() {

    then find:
    editor.innerHTML = code;
    replace:
    self.innerHTML = code;

    and everything works perfect! :D thank you jlewin, i needed this

     

    Last edit: Anonymous 2015-06-27

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.