Anybody know how to make a read-only Iframe?
-
I want to include some dynamic content from another site, but I want to restrict the user from clicking any of the links on that site so they can't navigate away from my page. Most of the things I have tried in terms of capturing mouse events to prevent navigation are ignored when the mouse is over the IFrame. Thanks in advance.
-
I want to include some dynamic content from another site, but I want to restrict the user from clicking any of the links on that site so they can't navigate away from my page. Most of the things I have tried in terms of capturing mouse events to prevent navigation are ignored when the mouse is over the IFrame. Thanks in advance.
yes, definitely you can make iframe read only..
//Paste the code inside the entity onload event box
var IFRAME_Test;
var IFRAME_Test_Disable_Message = "IFRAME Disabled...";function OnCrmPageLoad() {
//Reference the IFRAME
IFRAME_Test = document.all.IFRAME_Test;
//Bind to its ready state event (wait until the iframe is fully loaded)
IFRAME_Test.attachEvent( "onreadystatechange" , OnTestIframeReady );
}function OnTestIframeReady() {
if( IFRAME_Test.readyState != "complete" )
return;
//Override the onmousedown event
IFRAME_Test.contentWindow.document.onmousedown = OnTestIframeMouseDown;
}function OnTestIframeMouseDown() {
alert( IFRAME_Test_Disable_Message );
/* or use */
//the window is put beyond the user's desktop and is immediately closed
var stubWin = window.open(‘about:blank’,’’,’ toolbars=0,width=100,height=100,top=10000,left=10000’);
stubWin.close();
return false;
}//Entry point
OnCrmPageLoad();HTH
Jinal Desai - LIVE Experience is mother of sage....
-
yes, definitely you can make iframe read only..
//Paste the code inside the entity onload event box
var IFRAME_Test;
var IFRAME_Test_Disable_Message = "IFRAME Disabled...";function OnCrmPageLoad() {
//Reference the IFRAME
IFRAME_Test = document.all.IFRAME_Test;
//Bind to its ready state event (wait until the iframe is fully loaded)
IFRAME_Test.attachEvent( "onreadystatechange" , OnTestIframeReady );
}function OnTestIframeReady() {
if( IFRAME_Test.readyState != "complete" )
return;
//Override the onmousedown event
IFRAME_Test.contentWindow.document.onmousedown = OnTestIframeMouseDown;
}function OnTestIframeMouseDown() {
alert( IFRAME_Test_Disable_Message );
/* or use */
//the window is put beyond the user's desktop and is immediately closed
var stubWin = window.open(‘about:blank’,’’,’ toolbars=0,width=100,height=100,top=10000,left=10000’);
stubWin.close();
return false;
}//Entry point
OnCrmPageLoad();HTH
Jinal Desai - LIVE Experience is mother of sage....
Thanks, I've seen variants of that code segment on the web and they just seem to be ignored. I think I am not putting the start code in the right place and it is not being executed. I have also tried putting the OnCrmPageLoad() function call in the onload event for the iframe. Alot of these examples refer to Microsoft CRM and I don't think I am using that. I am just trying to do this with HTML and Javascript. Here is what I have now.
<HTML>
<HEAD><script language="javascript" type="text/javascript">
//Paste the code inside the entity onload event boxvar IFRAME_Test;
var IFRAME_Test_Disable_Message = "IFRAME Disabled...";function OnCrmPageLoad() {
//Reference the IFRAME
IFRAME_Test = document.all.IFRAME_Test;
//Bind to its ready state event (wait until the iframe is fully loaded)
IFRAME_Test.attachEvent( "onreadystatechange" , OnTestIframeReady );
}function OnTestIframeReady() {
if( IFRAME_Test.readyState != "complete" )
return;
//Override the onmousedown event
IFRAME_Test.contentWindow.document.onmousedown = OnTestIframeMouseDown;
}function OnTestIframeMouseDown() {
alert( IFRAME_Test_Disable_Message );
/* or use */
//the window is put beyond the user's desktop and is immediately closed
var stubWin = window.open(‘about:blank’,’’,’ toolbars=0,width=100,height=100,top=10000,left=10000’);
stubWin.close();
return false;
}//Entry point
OnCrmPageLoad();</script>
</HEAD>
&t;body><iframe id="IFRAME_Test" frameborder="1" width="800" style="z-index:1; height:400;" src="http://weathernow.denverpost.com/"></iframe>
</body>
</HTML>Thanks for the help.