FF compatible for IE attribute contentEditable

D

Dung Ping

The contentEditable is an IE-only attribute. It dosen't work on other
browsers. But it is said FF has a compaitable attribute with a
different name. How can I find out what the name is? Thanks.

Dung Ping
 
T

Toby Inkster

Dung said:
The contentEditable is an IE-only attribute. It dosen't work on other
browsers.

It is proprietry to IE.
But it is said FF has a compaitable attribute with a different name.

Mozilla 1.4+ and other browsers based on that engine (Netscape 7.1,
Firefox, Ephiphany, etc) do have a similar concept, though it's not
completely compatible. You must set the attribute on a whole document:
not just part of it (though that whole document could be loaded via an
iframe); and it must be set via Javascript.

<iframe id="myelement" src="data:Blah%20%3Cb%3Eblah%3C%2Fb%3E"></iframe>
<script type="text/javascript">
var e = document.getElementById("myelement");
e.contentDocument.designMode="on";
</script>

The easy thing to do it to use a library that smoothes over the
incompatibilities. I can recommend using widgEditor, which can be
downloaded free from http://www.themaninblue.com/experiment/widgEditor/

Of course, all these methods are proprietary and should not be relied upon
for a public website. Always provide a fall-back to a more standards
compliant way of editing the text, such as TEXTAREA; or thinking outside
the box, allow the user to download the file, edit it in a tool of their
choice (be that Word, Notepad, Dreamweaver or Emacs) and then send back
the file using a file upload form.

Looking towards the future, the closest thing to a standard method for
rich text editing that we're likely to see would be Web Applications 1.0,
which is being worked on jointly by Apple Computers Inc, the Mozilla
Foundation and Opera Software ASA. It is quite a way off from
implementation though.
 
D

Dung Ping

Thanks for help. I have some questions about the FF sample.
Toby said:
Mozilla 1.4+ and other browsers based on that engine (Netscape 7.1,
Firefox, Ephiphany, etc) do have a similar concept, though it's not
completely compatible. You must set the attribute on a whole document:
not just part of it (though that whole document could be loaded via an
iframe); and it must be set via Javascript.

<iframe id="myelement" src="data:Blah%20%3Cb%3Eblah%3C%2Fb%3E"></iframe>

In above line, is the word 'data' mandatory? What does the
Blah%20%3Cb%3Eblah%3C%2Fb%3E stand for? I know the the percentage
symbol plus a number stands for something, but don't remeber what.

Thanks again.
Dung Ping
 
T

Toby Inkster

Dung said:
In above line, is the word 'data' mandatory? What does the
Blah%20%3Cb%3Eblah%3C%2Fb%3E stand for? I know the the percentage
symbol plus a number stands for something, but don't remeber what.

IFRAME needs a SRC attribute to tell it where to get its contents.

Normally the source attribute will be "http://...something...", but could
also be "ftp://...something..." or "gopher://...something...". Basically
these are different URL-schemes, which indicate to the browser it should
recieve the file in different ways: using Hyper-Text Transfer Protocol,
using File Transfer Protocol, using Gopher, etc.

In this example, I've chosen to use "data:...something...". This tells the
browser it should retrieve the file by continuting to read the URL.

In this case, it will read:

Blah <b>blah</b>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top