--- loncom/interface/lonhtmlcommon.pm 2004/09/10 17:58:01 1.89 +++ loncom/interface/lonhtmlcommon.pm 2004/09/29 14:50:43 1.90 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.89 2004/09/10 17:58:01 banghart Exp $ +# $Id: lonhtmlcommon.pm,v 1.90 2004/09/29 14:50:43 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -524,6 +524,27 @@ sub javascript_nothing { } return $nothing; } + +############################################## +############################################## +sub javascript_docopen { + # safari does not understand document.open() and loads "text/html" + my $nothing = "''"; + my $user_browser; + my $user_os; + $user_browser = $ENV{'browser.type'} if (exists($ENV{'browser.type'})); + $user_os = $ENV{'browser.os'} if (exists($ENV{'browser.os'})); + if (! defined($user_browser) || ! defined($user_os)) { + (undef,$user_browser,undef,undef,undef,$user_os) = + &Apache::loncommon::decode_user_agent(); + } + if ($user_browser eq 'safari' && $user_os =~ 'mac') { + $nothing = "document.clear()"; + } else { + $nothing = "document.open('text/html','replace')"; + } + return $nothing; +} ##############################################