I'm trying to loop over all JavaScript variables to find ones that match a certain regex. The function works fine in every browser but IE, it appears that the for loop does not read in every global variable even though it's there. I can access the variable directly using window.variable but it does not appear in the loop.
var w = window;
var meta = '';
var reg = /meta_(.+)/;
var reg_r;
for (var k in w){
if (reg_r = reg.exec(k)){
if (typeof(w[k])!="undefined" && typeof(reg_r[1])!="undefined"){
meta += reg_r[1] + '=' + escape(w[k]) + '&';
}
}
}