打开 %FR_HOME%\WebReport\WEB-INF\reportlets\GettingStarted.cpt 文件,给“查询”按钮添加点击事件,如下图所示:

//设置或获取整个 URL 为字符串
var test1 = window.location.href;
alert('URL地址: '+test1);
//window.location.protocol(设置或获取URL的协议部分)
var test2 = window.location.protocol;
alert('URL协议: '+test2);
//window.location.host(设置或获取URL的主机部分)
var test3 = window.location.host;
alert('URL主机: '+test3);
//window.location.port(设置或获取与URL端口号)
var test4 = window.location.port;
alert('URL关联端口: '+test4);
//window.location.pathname(设置或获取与URL的路径部分(文件地址))
var test5 = window.location.pathname;
alert('URL文件路径地址: '+test5);
//window.location.search(设置或获取URL属性中跟在问号后面的部分)
var test6 = window.location.search;
alert('URL问号后部分: '+test6);
//window.location.hash(设置或获取URL属性中在“#”后面的内容)
var test7 = window.location.hash;
//获取URL对应的"标签名称"
var test7 = document.title;
alert('URL标签名称: '+test7);