106
rated 0 times
[
108]
[
2]
/ answers: 1 / hits: 37623
/ 13 Years ago, fri, july 1, 2011, 12:00:00
I'm trying to extract the current file name in Javascript without any parameters.
$(location).attr('href').match(/([a-zA-Z-_0-9]+.w+)$/);
var current_path = RegExp.$1;
if ((current_path == 'index.html') || ...) {
// something here
}
But it doesn't work at all when you access like http://example.com/index.html?lang=ja. Sure before the file name will be changed at random.
Any idea?
More From » jquery