NuxtN
Nuxt2y ago
21 replies
Victor Neves

javascript added using useHead is being executed on the server

I have a javascript to be executed on the client to check the browser version and also if some functionalities are available and if not match the criteria we redirect the user to a dedicated page (informing the user that he needs to update the browser)
But I see that the code added to the script tag is being executed on the server and being changed
original:
if (typeof window !== 'undefined') {
 ...
}


then turns into:
if ("undefined" !== 'undefined') {
 ...
}


How can I prevent/fix this?

Thanks
Was this page helpful?