我正在尝试使用该querySelectorAll()
方法来获取网页中的链接,但我想忽略以“javascript:”开头的链接或使用其他协议,如“itpc://”
有没有办法将这些包含在“not()”伪选择器中?
document.querySelectorAll("a:not([href^=javascript]):not([href^=itpc])"); //works
document.querySelectorAll("a:not([href^=javascript:]):not([href^=itpc://])"); //doesn't work
尽管第一种方法在当前页面上运行良好,但不能保证它会在我将使用它的每个页面上运行,所以我真的希望能够检测到那个冒号。