Thanks Zyloch for the prompt response.
The main issue I am trying to solve is to remove the unwanted "This page contains both secure and non secure items" message when browsing the page using an https enabled URL.
The reason why this message is displayed because of the fact that https enabled requests cannot interpret "about:blank" correctly. This is a bug that microsoft acknowledges. When you call an IFrame without an src element, the browser automatically assigns "about:blank" as the source for the frame. The site works perfectly when browsed through an http url.
So, In-order to overcome the issue, I have created a blank.htm file in the root and assigned it as the source for the IFrame. the code is given below
==========================
<SCRIPT TYPE="text/javascript">
function editInited(edit) {
edit.frameWindow.document.
//** PASS THE VALUE FROM THE HIDDEN VARIABLE ON REFRESH **
edit.frameWindow.document.
}
</SCRIPT>
<IFRAME ID="edit" CLASS="richEdit" usebr="true" oneditinit="editInited(thi
<BODY TOPMARGIN="0" LEFTMARGIN="0" STYLE="color: black; background: white;font: 11px verdana;">
</BODY>
</IFRAME>
==========================
This removes the secure/un-secure warning. However, the code for the rich text editor does not like this. It throws a permission denied error(the line is specified in the code). The code for the RTE is as follows..
//========================
//***** CODE COPYRIGHTED TO Copyright (c) 1999 - 2002 Erik Arvidsson (http://webfx.eae.net/cont
// Removing the long copyright spiel for ease of pasting the code here...
//========================
function initRichEdit(el) {
if (el.id) { // needs an id to be accessible in the frames collection
el.frameWindow = document.frames[el.id];
if (el.value == null)
el.value = el.innerHTML;
if ( el.value.replace(/\s/g, "") == "" )
el.value = "<html>\n" +"<head>\n<title></title>\
var d = el.frameWindow.document;
d.designMode = "On";
el.src = "blank.htm";
d.open();
d.write(el.value);
d.close(); //<--This is the line throwing the error
el.supportsXHTML = el.frameWindow.document.do
// set up the expandomethods
// first some basic
el.setHTML = function (sHTML) {
el.value = sHTML;
initRichEdit(el);
}
el.getHTML = function () {
// notice that IE4 cannot get the document.documentElement so we'll use the body
return el.frameWindow.document.bo
// for IE5 the following is much better. If you don't want IE4 compatibilty modify this
//return el.frameWindow.document.do
}
el.getXHTML = function () {
if (!el.supportsXHTML) {
alert("Document root node cannot be accessed in IE4.x");
return;
}
else if (typeof window.StringBuilder != "function") {
alert("StringBuilder is not defined. Make sure to include stringbuilder.js");
return;
}
var sb = new StringBuilder;
// IE5 and IE55 has trouble with the document node
var cs = el.frameWindow.document.ch
var l = cs.length;
for (var i = 0; i < l; i++)
_appendNodeXHTML(cs[i], sb);
return sb.toString();
};
el.setText = function (sText) {
el.value = sText.replace(/\&/g, "&").replace(/\</g, "<").replace(/\>/g, ">").replace(/\n/g, "<br>");
initRichEdit(el);
}
el.getText = function () {
// notice that IE4 cannot get the document.documentElement so we'll use the body
// not that it matters when it comes to innerText :-)
return el.frameWindow.document.bo
}
// and now some text manipulations
el.execCommand = function (execProp, execVal, bUI) {
return execCommand(this, execProp, execVal, bUI);
}
//BOLD
el.setBold = function () {
return this.execCommand("bold");
}
//ITALIC
el.setItalic = function () {
return this.execCommand("italic")
}
//UNDERLINE
el.setUnderline = function () {
return this.execCommand("underlin
}
//SET BACKGROUND COLOR
el.setBackgroundColor = function(sColor) {
return this.execCommand("backcolo
}
//SET FORECOLOR
el.setColor = function(sColor) {
return this.execCommand("forecolo
}
//CREATE HYPERLINK
el.setURL = function() {
return this.execCommand("CreateLi
}
//ALIGN LEFT
el.setAlignLeft = function() {
return this.execCommand("JustifyL
}
//ALIGN RIGHT
el.setAlignRight = function() {
return this.execCommand("JustifyR
}
//ALIGN CENTER
el.setAlignCenter = function() {
return this.execCommand("JustifyC
}
//ORDERED LIST
el.setOrderedList = function() {
return this.execCommand("insertor
}
//UNORDERED LIST
el.setUnOrderedList = function() {
return this.execCommand("insertun
}
//INDENT
el.setIndent = function() {
return this.execCommand("indent")
}
//OUTDENT
el.setOutdent = function() {
return this.execCommand("outdent"
}
//SETS THE FORE COLOR
el.SetForeColor = function() {
var arr = showModalDialog("RTE/Palet
if (arr != null) return this.execCommand("forecolo
}
//INSERTS PARAGRAPH
el.setParagraph = function() {
return this.execCommand("InsertPa
}
el.surroundSelection = function(sBefore, sAfter) {
var r = this.getRange();
if (r != null)
r.pasteHTML(sBefore + r.htmlText + sAfter);
};
el.getRange = function () {
var doc = this.frameWindow.document;
var r = doc.selection.createRange(
if (doc.body.contains(r.paren
return r;
// can happen in IE55+
return null;
};
/* modifies the enter keyup event to generate BRs. */
/* Enabled by default */
if (el.getAttribute("usebr"))
el.frameWindow.document.on
if (el.frameWindow.event.keyC
document.FrmTask.selStatus
return false;
}
if (el.frameWindow.event.keyC
var sel = el.frameWindow.document.se
if (sel.type == "Control")
return;
var r = sel.createRange();
r.pasteHTML("<BR>");
el.frameWindow.event.cance
el.frameWindow.event.retur
r.select();
r.moveEnd("character", 1);
r.moveStart("character", 1);
r.collapse(false);
return false;
}
};
el.frameWindow.document.on
el.frameWindow.document.on
if (el.frameWindow.event.keyC
el.frameWindow.event.cance
el.frameWindow.event.retur
return false;
}
};
}
// Add your own or use the execCommand method.
// See msdn.microsoft.com for commands
// call oneditinit if defined
if (typeof el.oneditinit == "string")
el.oneditinit = new Function(el.oneditinit);
if (typeof el.oneditinit == "function")
el.oneditinit();
}
function execCommand(el, execProp, execVal, bUI) {
var doc = el.frameWindow.document;
var type = doc.selection.type;
var oTarget = type == "None" ? doc : doc.selection.createRange(
var r = oTarget.execCommand(execPr
if (type == "Text")
oTarget.select();
return r;
}
}
function initAllRichEdits() {
var iframes = document.all.tags("IFRAME"
for (var i=0; i<iframes.length; i++) {
if (iframes[i].className == "richEdit")
initRichEdit(iframes[i]);
}
}
if (window.attachEvent) // IE5
window.attachEvent("onload
else if (document.all) // IE4
window.onload = initAllRichEdits;
==========================
Hope you understand the full extend of my problems :) BTW... I really dont think that placing of the function above or below the IFrame code is an issue since it is a Javascript function (Would have thrown an error if it cannot locate the function).
Cheers!
Sajit
Main Topics
Browse All Topics





by: ZylochPosted on 2005-08-27 at 08:16:38ID: 14768082
Hi ap_sajith,
body.style .color = "black"; body.inner HTML=windo w.document .all.txtDe scription. value;
s)" style="padding-top:0px;wid th:500px;h eight:200p x;border:0 px inset;" tabindex="4" src="about:blank"> und:white; font:11px verdana;">
I tried this out a few times and haven't found any errors whatsoever. I would recommend using about:blank instead of blank.htm since otherwise the iframe may look a bit weird.
Besides that, I think the most important thing is that your editInited function must go before the iframe code, meaning you have something like:
<script language="javascript" type="text/javascript">
<!--
function editInited(edit) {
edit.frameWindow.document.
//** PASS THE VALUE FROM THE HIDDEN VARIABLE ON REFRESH **
edit.frameWindow.document.
}
//-->
</script>
<iframe id="edit" class="richEdit" usebr="true" oneditinit="editInited(thi
<body topmargin="0" leftmargin="0" style="color:black;backgro
</body>
</iframe>
should be fine.
Regards,
Zyloch