You shouldn't have a problem if you know the text of the alert and don't mind getting dirty.
You can override the iframe window's alert with your own and do something to the effect of..
document.getElementById("InnerFrameName").contentWindow.alert = function(){
if (arguments[0].toLowerCase() == "innerframe alert text")
return; //supress
else
alert(arguments[0]);
};
Edit: I made a little test with a proxy handler (it's in asp.net/c# but you should get the idea)...
The external page in my test is a w3 page with a button that displays an alert, the alert is now passed through the user defined function.
I'm sure this is alot more dirty then you'd like to get.
Page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Hello From MyPage</title>
<script type="text/javascript">
function frameLoaded() {
document.getElementById("InnerFrameName").contentWindow.alert = function() {
if (arguments[0].toLowerCase() == "i am an alert box!!") {
alert("MESSAGES WOULD BE SUPRESSED: " + arguments[0]);
return; //supress
} else {
alert(arguments[0]);
}
};
}
</script>
</head>
<body onload="alert('Hello from an unsupressed top level frame message!');">
<form id="form1" runat="server">
<div>
<h1>Internal Page (Top Level)</h1>
<hr />
<iframe id="InnerFrameName" onload="frameLoaded();" src="PageProxy.ashx?externalURI=http://www.w3schools.com/JS/tryit_view.asp?filename=tryjs_alert"
style="width: 800px; height: 600px;">Derp!...</iframe>
</div>
</form>
</body>
</html>
Proxy Handler:
<%@ WebHandler Language="C#" Class="PageProxy" %>
using System;
using System.Web;
public class PageProxy : IHttpHandler {
public void ProcessRequest (HttpContext context) {
byte[] externalPage = new System.Net.WebClient().DownloadData(context.Request["externalURI"]);
context.Response.OutputStream.Write(externalPage, 0, externalPage.Length);
context.Response.End();
}
public bool IsReusable {
get {
return false;
}
}
}