Manage Learn to apply best practices and optimize your operations.

Prevent errors on iFramed pages with JavaScript

Errors can occur on deleted iFramed pages or when Lotus Notes users don't have page access. Fix them using JavaScript and the httpRequest object.

Related resources from
Access form fields in iFrame through Javascript when clicking an event outside iFrame

FAQ: Lotus Notes, Domino and JavaScript

JavaScript Reference Center

After deleting an iFramed page, unsightly errors can occur. Similar errors also occur if the Lotus Notes Domino user doesn't have access to the iFramed page. The following JavaScript code can be used to avoid such errors.

Using the httpRequest object, check the page header to trap the page status. If Domino serves iFramed pages, you can easily support custom applications status codes, if needed.

//helper function
function reGetUrlParameter( name , url ){
name = name.replace(/[[]/,"\[").
var regexS = "[\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
if( results == null ){
return "";
return results[1];

//get the httpRequest object
function getHttprequestObject(){
var mime = 'text/xml'; 
if(window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
}else if(window.ActiveXObject){
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

//check the iframed page and present 
something nice if it is not available function checkUrl(){
var params = xmlhttp.getResponseHeader("Set-Cookie");
//these params can be set in a computed for 
display field; use @SetHTTPHeader
var releasestatus = reGetUrlParameter
("someparamfromdoc", params); 
var pagestatus = xmlhttp.status;
if( pagestatus==200 ){
if( someparamfromdoc=="wrongstate" ){
stattxt = "Iframed page has wrong internal state."
}else if( pagestatus==401 ){
stattxt = "Iframed page is not accessable with
 your current access right."
}else if( pagestatus==404){
stattxt = "Iframed page has been deleted."
 if(stattxt != ""){ iframeHtml = stattxt }
 document.write( iframeHtml );

//just give the url to this function
function startUrlCheck(testUrl){
getHttprequestObject();"HEAD", testUrl, false);
xmlhttp.onreadystatechange = function(){
 if (xmlhttp.readyState==4){


Do you have comments on this tip? Let us know.

This tip was submitted to the tip library by member Steen Grunds. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Dig Deeper on JavaScript for Lotus Notes Domino

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...