去掉url前缀

5年以前  |  阅读数:398 次  |  编程语言:JavaScript 
function removeUrlPrefix(a) {
  a = a
    .replace(/:/g, ":")
    .replace(/./g, ".")
    .replace(///g, "/");
  while (
    trim(a)
      .toLowerCase()
      .indexOf("http://") == 0
  ) {
    a = trim(a.replace(/http:\/\//i, ""));
  }
  return a;
}

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8