JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 5th, 2005, 01:30 PM
goldrake73 goldrake73 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 7 goldrake73 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 30 sec
Reputation Power: 0
DesignMode doesn't work with generated iframe in mozilla

can anybody help me to make this work with mozilla ?

function createIframe()
{
// creates the iframe
var iframe=document.createElement("iframe");
iframe.setAttribute("id","myiframe");
iframe.setAttribute("width",750);
iframe.setAttribute("height",400);
iframe.setAttribute("frameborder",1);
document.body.appendChild(iframe);
// set designMode
document.getElementById('myiframe').contentWindow. document.designMode="on";
document.getElementById('myiframe').contentWindow. document.close();
}

Reply With Quote
  #2  
Old December 5th, 2005, 10:30 PM
Mittineague's Avatar
Mittineague Mittineague is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jul 2005
Location: West Springfield, Massachusetts
Posts: 552 Mittineague User rank is Private First Class (20 - 50 Reputation Level)Mittineague User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 33 sec
Reputation Power: 14
mozilla

Assuming the newlines between "....contentWindow." and "document...." are a product of the forum and not in your code (like the unwanted space in the code snippet below), I substituted the ".......close();" line with
Code:
try {
    document.getElementById('myiframe').contentWindow.  document.execCommand("undo", false, null);
  }  catch (e) {
    alert("This demo is not supported on your level of Mozilla.");
  }
I tried the page in Mozilla 1.7.11 and did not get the alert, so what there is for code does appear to be working OK. I put the script in the head and called the function with the body tag onload.

Reply With Quote
  #3  
Old December 6th, 2005, 01:21 AM
goldrake73 goldrake73 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 7 goldrake73 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 30 sec
Reputation Power: 0
It doesn't work...

I tried but it doesn't work...
the strange thing is that if I create the HTML via document.write, it works correctly but if i generate the HTML it doesn't work...
Another idea ?

Reply With Quote
  #4  
Old December 6th, 2005, 07:34 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
I believe design mode is only supported by IE.
Mozilla has a good guide titled Converting an app using document.designMode from IE to Mozilla.
Their demo works in both IE and Firefox.
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
  #5  
Old August 18th, 2006, 03:59 PM
rstackhouse rstackhouse is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 1 rstackhouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 53 sec
Reputation Power: 0
Quote:
Originally Posted by goldrake73
can anybody help me to make this work with mozilla ?

function createIframe()
{
// creates the iframe
var iframe=document.createElement("iframe");
iframe.setAttribute("id","myiframe");
iframe.setAttribute("width",750);
iframe.setAttribute("height",400);
iframe.setAttribute("frameborder",1);
document.body.appendChild(iframe);
// set designMode
document.getElementById('myiframe').contentWindow. document.designMode="on";
document.getElementById('myiframe').contentWindow. document.close();
}


According to this article http://developer.apple.com/internet/webcontent/iframe.html
Netscape and Firefox browsers need a moment after creating an inline frame before making its contents editable.

Try this:

function createIframe()
{
// creates the iframe
var iframe=document.createElement("iframe");
iframe.setAttribute("id","myiframe");
iframe.setAttribute("width",750);
iframe.setAttribute("height",400);
iframe.setAttribute("frameborder",1);
document.body.appendChild(iframe);
// set designMode
setTimeout("enable();", 10);
document.getElementById('myiframe').contentWindow. document.close();
}

function enable()
{
document.getElementById('myiframe').contentWindow. document.designMode="on";
}

If that doesn't work, try extending the timeout.

Hope this helps.

Reply With Quote
  #6  
Old August 24th, 2011, 05:05 AM
lbasha lbasha is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 1 lbasha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 37 sec
Reputation Power: 0
Smile It works!

Hi rstackhouse,

I had same problem of iframe working in IE but not in Firefox. This was due to Firefox browsers need a moment after creating an in-line frame before making its contents editable.

setTimeout("Myfunction();", 10); is really works.

Thank you.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > DesignMode doesn't work with generated iframe in mozilla


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap