Im working on an vue app where im getting some errors due to script executing on some sites. If i add the following code, my problem gets fixed:
if (
window.location.href ===
'chrome-extension://fbdhgoijldjhaidjclojhnbibaipkfmn/index.html#/'
) {
console.log('dont run')
} else {
new Vue({
el: '#context-menu-app-1',
// components: { App },
render: (h) => h(App)
})
}
However the value "chrome-extension://fbdhgoijldjhaidjclojhnbibaipkfmn/index.html#/" will vary depending on user, so i cant use this as a permanent fix. Instead im trying to match my condition to search if the href value starts with 'chrome-extention' , like so:
if (window.location.href.indexOf('chrome-extension://')) {
console.log('dont run')
} else {
new Vue({
el: '#context-menu-app-1',
// components: { App },
render: (h) => h(App)
})
}
But its not working, with the indexOf method, my error comes back. Any advise how to handle this?
Aucun commentaire:
Enregistrer un commentaire