Open eriklight opened 7 years ago
说明,对于在index.html中定义了mediaURL,并写死地址的问题,修改策略如下:
function runSeekStr(str, from, to) { var mystr = str; var newstr = 0; var str = str.toLowerCase(); var from = from.toLowerCase(); var to = to.toLowerCase(); if (!(str.indexOf(from)+1)) { return newstr; } var fromhere = str.indexOf(from)+from.length; var tostr = str.substr(fromhere, str.length-fromhere); mystr = mystr.substr(fromhere, str.length-fromhere); var tothere = tostr.length; if (to != "" && (tostr.indexOf(to)+1)) { tothere = tostr.indexOf(to); } newstr = mystr.substr(0, tothere); if (!newstr.length) { newstr = 0; } return newstr; }
mediaURL = runSeekStr(window.document.location.href,"inimedia=", "&");
findSWF("main").focus();//替换方法 function findSWF(swf) { if (navigator.appName.indexOf("Microsoft") != -1){ return window[swf] } else { return document[swf] } }