Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

window.frames ot working in IE

Featured Replies

any ideas on how i can mage the below javascript worki in IE it works in all non IE Browsers

 

 function changeHeading(heading) {
 var range = window.frames['textEditor'].getSelection().getRangeAt(0);
    var newNode = document.createElement(heading);
    range.surroundContents(newNode);
}

 

Thank you

  • Author

it seems ie does not support range although this can be worked arround, the problem seems to be finding the content of the iframe in IE Browsers

 

the following will not work in Iframes in IE

 

<iframe name="textEditor" id="textEditor" width="908" height="400"></iframe>

$("#textEditor").contents().find('body').html();

It's been a long time since I've played with iframes, but have you tried something like this:

 

window.frames['textEditor'].window.document.body.innerHTML

It might be missing the <body> itself but I think that will give you the contents.

  • Author

I have a WYSIWYG working in all browsers including adding h tags

 

when using the execCommand for headers it only works in Firefox so i needed a way around this

 

http://quirksmode.org/dom/execCommand.html

 

code below if it helps some one

 

function changeHeading(heading) {

 if($.browser.msie && $.browser.version == 7 || $.browser.version == 8 || $.browser.version == 9)
 {
   Selection = window.frames['textEditor'].document.selection.createRange().htmlText;
   window.frames['textEditor'].document.selection.createRange().pasteHTML("<"+heading+">"+Selection+"</"+heading+">")
 }
 else
     {
    var range = window.frames['textEditor'].getSelection().getRangeAt(0);
       var newNode = document.createElement(heading);
       range.surroundContents(newNode);
     }
}

 

Thank you

Edited by ELITE

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.