SPS默认门户站点上有一个帮助链接,这个链接显示的是SPS产品的一些信息,对于最终用户而言毫无意义,希望可以去掉,在MSD2D网站上看到一篇文章介绍如何去除这个链接,基本操作过程如下:
1 定位OWSBROWS.JS文件,这个文件在%SystemRoot%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\template\layouts\2052目录中
2 在该文件中加入一个Window Load事件响应函数,以删除帮助链接,源代码如下转载自MSD2D
定制SharePoint Portal之去除帮助链接/*ideas coming from Mark Beecham
定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接http://www.msd2d.com/Content/Tip_viewitem_03.aspx?section=SharePoint&category=Development&id=b73b9ea8-a678-47d0-b440-002b7f1c5ab3
定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接
*/
定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接
/*
定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接Open the OWSBROWS.JS and locate the line:
定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接var browseris = new Browseris();
定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接Paste the following code under this line.
定制SharePoint Portal之去除帮助链接
*/
定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接
/* START - Custom Code*/
定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接
//Remove Only Help from the top Banner定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接

定制SharePoint Portal之去除帮助链接
//Attach to Load event
定制SharePoint Portal之去除帮助链接
window.attachEvent("onload"new Function("DelHelp_OnLoad();"));
定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接
//Handles Addition of "Remove Help" link from top banner
定制SharePoint Portal之去除帮助链接
function DelHelp_OnLoad()
定制SharePoint Portal之去除帮助链接{
定制SharePoint Portal之去除帮助链接    
try{
定制SharePoint Portal之去除帮助链接            
//hlMySite.innerText="";    //this hidden code line can remove the "MySite"from the top banner
定制SharePoint Portal之去除帮助链接
            
定制SharePoint Portal之去除帮助链接            
//Get all Tags named "A"
定制SharePoint Portal之去除帮助链接
            var aTags = document.getElementsByTagName("A");
定制SharePoint Portal之去除帮助链接            
定制SharePoint Portal之去除帮助链接            
//Look for "Help" innerText - generally speaking it is the first one
定制SharePoint Portal之去除帮助链接
            for(var j=0;j<aTags.length;j++){
定制SharePoint Portal之去除帮助链接            
定制SharePoint Portal之去除帮助链接                
var aTag = aTags(j);
定制SharePoint Portal之去除帮助链接                
//If match found定制SharePoint Portal之去除帮助链接
定制SharePoint Portal之去除帮助链接
                if(aTag.innerText=="帮助")
定制SharePoint Portal之去除帮助链接                {
定制SharePoint Portal之去除帮助链接                    aTag.innerText
="";//assign the empty string to it;
定制SharePoint Portal之去除帮助链接
                    break;//foudn and then get out of the loop
定制SharePoint Portal之去除帮助链接
                }//end of if
定制SharePoint Portal之去除帮助链接
               }//end of for
定制SharePoint Portal之去除帮助链接
    
定制SharePoint Portal之去除帮助链接    }
//try
定制SharePoint Portal之去除帮助链接
    catch(e){
定制SharePoint Portal之去除帮助链接        
//Do Nothing - if it doesn't work then no logout appears
定制SharePoint Portal之去除帮助链接
    }//end of try
定制SharePoint Portal之去除帮助链接
    
定制SharePoint Portal之去除帮助链接}
//end of fucntion Del Help
定制SharePoint Portal之去除帮助链接/*
 END - Custom Code*/

3 保存后刷新网页即可看到效果

另:OWSBROWS.JS作用于所有网页,修改之后SPS所有网页都将没有帮助菜单。注意编辑OWSBROWS.JS文件时注意该文件是UTF-8格式,注意保持格式,特别是中文版SPS,我一开始没有注意,始终不能使aTag.innerText=="帮助"条件成立。 修改之后的效果你可以看到帮助链接一闪之后就消失了,这是因为实际上SPS是将该链接生成并送到浏览器了,而加入的代码在页面加载时在将该链接去掉所以看不到,实际上在页面的HTML源代码中还是看得到这个链接的。尽管如此,这个方法应该是比较好的一个了(除非重新开发一个服务端控件代替SPS自带的那个):帮助链接由SPSWC:PageHeader服务端控件生成,这类控件运行机制我还不清楚,但是其运行代码应该已经编译成DLL了。

相关文章:

  • 2021-10-19
  • 2021-08-25
  • 2021-05-28
  • 2021-06-16
  • 2021-12-20
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
  • 2021-06-03
相关资源
相似解决方案