related (sort of) to this question. I have written a script that will loop through an object to search for a certain string in the referring URL. The object is as follows:
var searchProviders = {
  "google": "google.com",
  "bing": "bing.com",
  "msn": "search.msn",
  "yahoo": "yahoo.co",
  "mywebsearch": "mywebsearch.com",
  "aol": "search.aol.co",
  "baidu": "baidu.co",
  "yandex": "yandex.com"
};
The for..in loop I have used to loop through this is:
for (var mc_u20 in mc_searchProviders && mc_socialNetworks) { 
    if(!mc_searchProviders.hasOwnProperty(mc_u20)) {continue;}
    var mc_URL = mc_searchProviders[mc_u20];
    if (mc_refURL.search(mc_URL) != -1) {
        mc_trackerReport(mc_u20);
        return false;
    }
Now I have another object let's call it socialNetworks which has the following construct:
var socialNetworks = {"facebook" : "facebook.co" }
My question is, can I loop through both of these objects using just one function? the reason I ask is the variable mc_u20 you can see is passed back to the mc_trackerReport function and what I need is for the mc_u20 to either pass back a value from the searchProviders object or from the socialNetworks object. Is there a way that I can do this?
EDIT: Apologies as this wasn't explained properly. What I am trying to do is, search the referring URL for a string contained within either of the 2 objects. So for example I'm doing something like:
var mc_refURL = document.referrer +'';
And then searching mc_refURL for one of the keys in the object, e.g. "google.com", "bing.com" etc. 9this currently works (for just one object). The resulting key is then passed to another function. What I need to do is search through the second object too and return that value. Am I just overcomplicating things?
 
     
     
     
    