f0731de27acad2eb67d7e22064413259b4587547 tdreszer Fri Jul 15 11:29:53 2011 -0700 Strange trick to avoid FF back button issue. diff --git src/lib/htmshell.c src/lib/htmshell.c index 2d5993b..28bccc4 100644 --- src/lib/htmshell.c +++ src/lib/htmshell.c @@ -228,30 +228,31 @@ "<UL id='warnList'></UL>" "<CENTER><button id='warnOK' onclick='hideWarnBox();return false;'></button></CENTER>" "</div></center>\");\n"); fprintf(f,"function showWarnBox() {" "document.getElementById('warnOK').innerHTML=' OK ';" "var warnBox=document.getElementById('warnBox');" "warnBox.style.display=''; warnBox.style.width='65%%';" "document.getElementById('warnHead').innerHTML='Error(s):';" "}\n"); fprintf(f,"function hideWarnBox() {" "var warnBox=document.getElementById('warnBox');" "warnBox.style.display='none';warnBox.innerHTML='';" "var endOfPage = document.body.innerHTML.substr(document.body.innerHTML.length-20);" "if(endOfPage.lastIndexOf('-- ERROR --') > 0) { history.back(); }" "}\n"); // Note that the OK button goes to prev page when this page is interrupted by the error. +fprintf(f,"window.onunload = function(){}; // Trick to avoid FF back button issue.\n"); fprintf(f,"</script>\n"); } void htmlVaWarn(char *format, va_list args) /* Write an error message. */ { va_list argscp; va_copy(argscp, args); htmlWarnBoxSetup(stdout); // sets up the warnBox if it hasn't already been done. char warning[1024]; vsnprintf(warning,sizeof(warning),format, args); char *encodedMessage = htmlEncodeText(warning,TRUE); // NOTE: While some internal HTML should work, a single quote (') will will screw it all up! printf("<script type='text/javascript'>{showWarnBox();" "var warnList=document.getElementById('warnList');" "warnList.innerHTML += '<li>%s</li>';}</script><!-- ERROR -->\n",encodedMessage); // NOTE that "--ERROR --" is needed at the end of this print!!