"startsWith" not supported by some browsers, so "substring" instead