Some customers once thought that the cancellation of the SharePoint site was not friendly enough. They wanted to click it to log out. They checked out the cancellation of the SharePoint site in singout under _ layouts. the ASPX page is a short JavaScript code, as shown in the following figure. When you click logout, it will be transferred to this page: Function _ spbodyonload () { Try { Document.exe ccommand ("clearauthenticationcache "); } Catch (e ){} Window. Close (); } I once saw a webpart written by a buddy on OTEC, which is actually a piece of JS. In fact, if I only want to implement this script, there is no need to create a webpart. <Script language = "JavaScript" type = "text/JavaScript"> <! -- VaR onerror = stoperror; Function stoperror () { Return true; } If (navigator. appversion. indexof ("MSIE")> 0) { Try { VaR oelement = Document. getelementbyid ("idbuttonlogoff "); Alert ('strike' + oelement. innerhtml ); // Oelement. style. Display = "Block "; } Catch (e ){} } Function logoff () { Try { If (navigator. appversion. indexof ("MSIE 6.0")> 0) { Document.exe ccommand ("clearauthenticationcache", "false "); Alert ('you have been logged off from this Web site. note that if you run Internet Explorer 6.0 without Service Pack 1 you need to close all browser windows in order to complete the log off process. '); Self. Location. href = "."; } Else if (navigator. appversion. indexof ("MSIE 6.0")> 0 | navigator. appversion. indexof ("MSIE 5.0")> 0 | navigator. appversion. indexof ("MSIE 5.5")> 0 )) { Alert ('note that if you run Internet Explorer 5.x you need to close all browser windows in order to complete the log off process .'); } Else { Alert ("this feature requires Internet Explorer 6.0 Service Pack 1 or above ."); } } Catch (E) { Alert ("this feature requires Internet Explorer 6.0 Service Pack 1 or above ."); } } // --> </SCRIPT> & nbsp;
if you are interested, study it. |