2

Perhaps you have heard about JavaScript Document's execCommand() function, which we often use to make rich text editors. It had a bad reputation before as Internet Explorer worked differently with it. Here are my questions.

  1. Today, do all the elements of execCommand work on all browsers? Like save as, bold, italic, etc...?

  2. If you want to make a rich text editor, is execCommand the appropriate choice today?

  3. Can you give me a website where I can find all the elements this function offers? Because I visited some, but they are just showing bold, italic and others. I want the complete updated lists.

2
  • 1
    I know javascript very well, and I don't know of an exec command. I know of an exec method for regex, but not something to do with rich text editors. I think you are mistaken somewhere, or missing out a huge chunk of info. Commented Nov 2, 2012 at 20:03
  • 1
    Do you mean document.execCommand? Commented Nov 2, 2012 at 20:06

2 Answers 2

0

Quirksmode has an (oldish) compatibility table of document.execCommand.

I think the best would be to mix execCommand with selection/range & DOM manipulation for a rich-text editor.

Edit:

Related questions:

Sign up to request clarification or add additional context in comments.

2 Comments

@user1780468 Quirksmode is not updated... yes, i know, that's why i wrote oldish, but there you can see which commands exists (& if you want to support older browsers too - like IE 6/7 - it is the best source)
createrange has issues in chrome and IE. Based on all functions I want, they work in all current browsers, I just read on it. IE 6 and 7 will have issues, but I dont think this will be a big problem as many people do no it use them... So, I will go with document.execcommand... I will ad more features.... By the way, adding too much things in rich text editor will not help you.. People who use CKEditor or TinyMCE, do not use all the functions of them..
0

I had a similar requirement and came across a rich source of such commands. This list is exhaustive, IMO, and also provides compatibility with various browsers.

http://help.dottoro.com/larpvnhw.php

I've not been able to make it work with Chrome at all, while some work with IE and all the commands run smoothly with Firefox.

Hope this helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.