0
如何在页面为index.html的情况下运行jquery脚本。 当我在浏览器中输入URL时,如http://qubedns.co.in/会自动执行但不显示主页名称(默认)。 不像http://qubedns.co.in/index.html如何在页面为index.html的情况下运行jquery脚本
我想要当前页面名称,当用户点击网址http://qubedns.co.in/运行一些脚本。如果我得到页面名称'index/html',我会完成它。
我用于其他页面
var currPageView = document.location.pathname.match(/[^\/]+$/)[0];
if(currPageView == 'index.html')
{
// My Script here
}
我已经尝试:
var currPageView;
if($(location).attr('href')=='http://qubedns.co.in'){
currPageView == window.location.host + '/' + 'index.html';
}else{
currPageView = document.location.pathname.match(/[^\/]+$/)[0];
}
是不是?其他解决方案?
使用'窗口。 location.href.match(/index.html $ /)。length> 0' –