精品推荐
代码保留 IE8中如何添加Activity
日期:2008年4月8日 作者: 查看:[大字体
中字体 小字体 ]
IE8中添加Activity的JavaScript脚本(这是一个来自淘宝网的例子)、 <script type="text/javascript"> function addActivity() { if (navigator.userAgent.indexOf('MSIE 8') == -1) { alert('请首先安装IE8.'); } else { window.external.addService('activities/taobao-search.xml'); } } </script> 相关XML描述文件:http://ie8.taobao.com/activities/taobao-search.xml <?xml version="1.0" encoding="UTF-8" ?> <openServiceDescription xmlns="http://www.microsoft.com/schemas/openservicedescription/1.0"> <homepageUrl>http://www.taobao.com</homepageUrl> <display> <name>淘宝搜索更多细节请查看活动白皮书。 写了一个简单的Google搜索的Activity XML: <?xml version="1.0" encoding="UTF-8" ?> <openServiceDescription xmlns="http://www.microsoft.com/schemas/openservicedescription/1.0"> <homepageUrl>http://www.google.com</homepageUrl> <display> <name>Google Search </name> <icon>http://www.google.com/favicon.ico</icon> </display> <activity category="Find"> - <activityAction context="selection"> <preview action="http://www.google.com/search?q={selection}" /> <execute method="get" action="http://www.google.com/search?q={selection}" /> </activityAction> </activity> </openServiceDescription> 其中有句用于描述homepageUrl节点的说明:The main URL of the Activity where the user can access the service through browsing. All URLs expressed in this format must match the domain of the homepageUrl.也就是后续的所有的URLs都必须与主页Url在相同的域中。比如上例中就必须都是google.com域中。 openServiceDescription是专门用于Activity的xml节点名。 形如selection的位置,若在尾部加“?”则表示若该标记为空,将以空格代替。如: <execute method="get" action="http://example.com/done.aspx?url={documentUrl}&title={documentTitle?}" /> 其中documentUrl是必选项,而documentTitle因为带了“?”,所以是可选项。 另外以下几种简单的标记在“预览”窗体中是不会有效的。 · <select> · <input type="text"> · <text area> 关于脚本: //JavaScript API for Activities //检查服务是否已经安装了 //参数:Service XML,name window.external.IsServiceInstalled("http://maps.live.com/GetMap.xml", "map"); //添加服务 //参数:Service XML window.external.AddService("http://maps.live.com/GetMap.xml");
复制本页网址和标题,发送给你QQ/Msn的好友一起分享
上一篇:拼音五笔输入法技巧集
下一篇:同花顺2008软件评测之公式选股篇
相关文章:
相关软件: