var isGecko = navigator.userAgent.toLowerCase().indexOf("gecko") != -1; var iframe = (isGecko) ? document.getElementById("frameId") : frames["frameId"];