// // ********************************************************************* // wfwiblib.js - A single library included as part of all pages with // various utility functions // ********************************************************************* // ********************************************************************** // Reusable, robust window opener // Credits: http://devedge.netscape.com/viewsource/2002/popup-control/ // ********************************************************************** // Notes: // The onLoad event handler is the target of most window suppression mechanisms. // MSIE versions through 6.0 do not support this suppression, although add-ins may. // Mozilla 1.1x+ provides a preference for "Advanced - Scripts & Plugins", deselect, // Allow Scripts to: Open unrequested windows. // Furthermore, if you and edit prefs.js you can suppress a great deal. // Other articles pertaining to browser preferencs/windows: // http://www.mozilla.org/unix/customizing.html // http://www.mozilla.org/projects/security/components/ConfigPolicy.html // Opera 7.x provides the greatest/easiest degree of control over scripting, windows, frames, etc. // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- // Usage: // // This example takes all the defaults, and takes the href object as the url. // // onClick event Handler //
Clicking a demonstration // link will open a new browser
// // ----------------------------------------------------------------------- function wfOpenWin(url, wname, wfeatures) { // // where the parameters are: // url = the url of the child window // wname = window name // wfeatures = window features: browser chrome, window position [defaults to 300x300 chromeless window] // newwin = ''; // add some parameter checking and reasonable defaults if (!wname) { wname = 'Help'; } if (!wfeatures) { // with the exception of height/width (<400) other chrome per WRD recommendations wfeatures = 'height=300,width=300,toolbar=no,locationbar=no,personalbar=no,menubar=yes,status=yes,resizable=yes'; } if (!url) { url = 'about:blank'; } // attempt to open the popup if ( hasTryCatch() ){ // any browser that can suppress window pop-ups, is modern enough to have JS 1.5/EcmaScript 3rd ed. // hide the try from NN4.x since it can not compile the script if it "sees" it eval("try { newwin = window.open(url, wname, wfeatures); } catch (e) { newwin = ''; }"); } else { // older browsers that don't JS 1.5 also do not support window suppression newwin = window.open(url, wname, wfeatures); } // check results if (newwin !== '') { // popup succeeded // Notes: Opera was causing unknown errors on focusing. This will bypass the problem, but won't bring the child into focus. // When Opera preferences set to: Pop-ups=Refuse pop-ups, will supress window.open calls altoghether and return true, // so that the link is followed. if (!window.opera) {newwin.focus();} } else { // popup failed showPopUpMsg(url); } return; } // // Used by: wfOpenWin // function showPopUpMsg(url) { // intialize some stuff var cname = 'popupmessage'; var warningtext ='Your computer settings do not allow other browser windows to open, which prevents our site from working properly.'; warningtext += ''; warningtext += 'Open the page in this window' + '<\/a>.<\/p>'; warningtext += '