Currently, I am working on a vue application where I encountered some errors related to script execution on certain websites. By implementing the following code snippet, the issue is resolved:
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 specific value 'chrome-extension://fbdhgoijldjhaidjclojhnbibaipkfmn/index.html#/' will vary for each user, making it impossible to use as a permanent solution. Instead of hardcoding this value into my condition, I attempted to check if the href contains the substring 'chrome-extension' by using the indexOf method:
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)
})
}
Unfortunately, this approach did not work as expected, and the error resurfaced. Can someone provide guidance on how to effectively handle this situation?