Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8370653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:57:52+00:00 2026-06-09T13:57:52+00:00

I am designing a simple Rich Text Editor using HTML/Javascript. It uses iframe. While

  • 0

I am designing a simple Rich Text Editor using HTML/Javascript. It uses iframe. While it is working great in IE6 (and possibly newer IE versions), it is broken in FireFox. The iframe cannot be edited or used in any way.

The HTML <body>

<input type="button" id="bold" class="Button" value="B" onClick="fontEdit('bold');">
<input type="button" id="italic" class="Button" value="I" onClick="fontEdit('italic');">
<input type="button" id="underline" class="Button" value="U" onClick="fontEdit('underline');">
<hr>
<iframe id="TextEditor" class="TextEditor"></iframe>

The Javascript (for IE)

TextEditor.document.designMode="on";
TextEditor.document.open();
TextEditor.document.write('<head><style type="text/css">body{ font-family:arial; font-size:13px; }</style> </head>');
TextEditor.document.close();
TextEditor.focus();

The above script makes iframe editable in IE. Fails to do so in FF. So I changed a few things for FF version-

The Javascript (for FF)

id("TextEditor").contentWindow.designMode="on";
id("TextEditor").contentWindow.open(); //this line is responsible for pop-ups
id("TextEditor").contentWindow.write('<head><style type="text/css">body{ font-family:arial; font-size:13px; }</style> </head>'); //this line throws error: id("TextEditor").contentWindow.write is not a function at the FF debug console.
id("TextEditor").contentWindow.close();
id("TextEditor").focus();

This section of code makes FF provoke an pop-up alert with a blank page as a target. It’s still broken. What now follows are general functions for things like id() and fontEdit()–

function fontEdit(x,y){
  TextEditor.document.execCommand(x,"",y);
  TextEditor.focus();
}

function id(id){
  return document.getElementById(id);
}

function tag(tag){
  return document.getElementsByTagName(tag);
}

I’m sure FF doesn’t handle iframe this way. So how do I get iframe to be used as a Rich Text Editor and without showing pop-ups. Please try your best to avoid jQuery since I’m not that good in it yet. Which is why the custom functions like id() and tag() exists.

And, I’m aware that there are other freely available Text Editors for me to download and use so please do not suggest me any such solutions and do not ask me why I must re-invent the wheel. Only answer if you know where I am going wrong and if you can actually help me fix the problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:57:53+00:00Added an answer on June 9, 2026 at 1:57 pm

    FF provoke an pop-up alert with a blank page as a target because you are calling the function window.open, instead you shoud call document.open.

    window.open: opens a new browser window.

    document.open: It opens an output stream to collect the output from any document.write() or document.writeln() methods. Once all the writes are performed, the document.close() method causes any output written to the output stream to be displayed.
    Note: If a document already exists in the target, it will be cleared.

    See The open() method

    This should works for you:

    id("TextEditor").contentWindow.document.designMode="on";
    id("TextEditor").contentWindow.document.open(); //this line is responsible for pop-ups
    id("TextEditor").contentWindow.document.write('<head><style type="text/css">body{ font-family:arial; font-size:13px; }</style> </head>'); //this line throws error: id("TextEditor").contentWindow.write is not a function at the FF debug console.
    id("TextEditor").contentWindow.document.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm designing a simple text editor using WxPython, and I want to put the
Okay, so I'm designing this site. Here's the HTML markup of this simple element:
I'm designing an HTML page for display in Android browsers. Consider this simple example
Designing a simple HTML table that I am going to implement alternate-row coloring on...
I'm designing a game and thinking about using WPF for making a simple prototype
I am designing a simple application using c# and it has a web browser
I'm designing a very simple web page (HTML only), the only feature I want
I am designing a simple C# WCF service using ASP.NET 4.0 and hosted on
I'm designing a simple game, which uses Java 2D and Newtonian physics. Currently my
I am designing a simple enough report using iReport 4.5.0. It's a header/detail affair,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.