I noticed an issue when working with the [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)
interface in the content script. I am trying to get hold of the keys
in the “search” part of a URL.
This works when I try on the browser’s JS console. But when I do the same in the content script’s console, I get an error saying TypeError: obj.searchParams.keys(...) is not iterable
.
See outputs below:
obj = new window.URL("https://www.somwebsite.com/show/3001C?name=asd")
keys = [...obj.searchParams.keys()]
// On a regular browser console => Array [ "name" ]
// On content script's console => TypeError: obj.searchParams.keys(...) is not iterable
Are there limitations on the URL
and related APIs in the content script?
BTW, this works just fine on Chrome.