In my code, I want to check if on the page you are on, if certain requirements are met with the url, do something
It is saying it cannot get the toLowerCase of undefined
this is my code, thanks
Also, I do have tab permissions in the manifest This file runs in the background, I want it to execute for every page you open
var names = ['hunter5deer', 'pielovingcat', '199MS', 'harrdy']
$(function() {
for (i=0;i<names.length;i++) {
var currentPage;
chrome.tabs.getSelected(null,function(tab) {
currentPage = tab.url;
});
var page;
if (currentPage.toLowerCase().indexOf("item?id=") > -1) {
page = 'seller';
name(page, names[i]);
}
else if (currentPage.toLowerCase().indexOf("showpost.aspx?postid=") > -1) {
page = 'forum';
name(page, names[i]);
}
else if (currentPage.toLowerCase().indexOf("user.aspx?") > -1) {
page = 'profile'
name(page, names[i]);
}
}
});