Thursday, February 11, 2010

Creating a Browser Not compatible message

Angel provides a SystemCheck Nugget that you can download from their support center. It works well, and lets your users know if they have all the necessary components installed. Unfortunately, it isn't very "loud" if a user is using an unsupported browser, such as Safari. So today, I am going to detail how to modify the check nugget to have a javascript alert message display.

Additionally, if you aren't the coding type of person, a zipped file with these changes already in place can be found here.

You will only need to modify the default.asp file found in the SystemCheck folder. So open that file now in your favorite editor. Do a find for "switch (caps.browser.type)" (without the quotes). This will take you to the part of the code that you need to edit.

If you wish to display a message to IE 6.0 users add the following code under sBrowserIcon = "explorer";
if (caps.browser.version == "6") {
sBrowserIcon = "whitespace";
sUnsupported = '<tr><td colspan=2><img src="' + sIconPath + 'warning.gif" alt="<%=dLang("Warning")%>" valign=textbottom hspace=2><span style="color:red"><%=dLang("InvalidBrowser")%></span></td></tr>\n';
alert("You have an old version of Internet Explorer. Please use IE 7.0+ or Firefox.");
}
This does two things. It displays a message on the System Check nugget itself that the browser is not supported. Additionally, it will display a popup alert message.

To add one specifically against Safari, you will now add the following code before default:

case 'Safari':
sBrowserIcon = "whitespace";
sUnsupported = '<tr><td colspan=2><img src="' + sIconPath + 'warning.gif" alt="<%=dLang("Warning")%>" valign=textbottom hspace=2><span style="color:red"><%=dLang("InvalidBrowser")%></span></td></tr>\n';
alert("Safari is not a supported browser. Please use Firefox, or if on Windows IE 7 or greater.");
Also be sure to add a break; command before the case 'Safari': line.

If you have any questions, feel free to contact me here or elsewhere.

Cya,
Paul

3 comments:

Suzanne said...

Just checking here, is this the sort of thing that I, as an instructor, can implement? Or do I need the techie people at school to implement it for me?

Suzanne said...

PS On you blog page, your "Subscribe to comments" link is wonky.

Paul Branham said...

Thanks for the info on the subscribe not working. I'll work on that.

You'll need an IT person to put it on your server, as a portal component. From there, it can be added as a nugget to your course.

Thanks,
Paul