How to hide JS files publicly from the browser?

Deshmukh, Vijit 496 Reputation points

Hi Team,

We have deployed UI application to the azure app service source code is in VUE js application.

we want to hide JS files publicly from the browser tab please let us know how we can do that.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,323 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Lex Li (Microsoft) 5,237 Reputation points Microsoft Employee

    HTML, JavaScript and CSS files are public and visible in browsers for decades, and there is no way to hide. You might obfuscate and minimize them to raise the bar though.

  2. ajkuma 24,561 Reputation points Microsoft Employee

    @Deshmukh, Vijit ,

    You won't be able to hide the JS files from the developer tools for those that can access the page/Webapp. If your goal is to prevent someone from opening the dev tools or clicking view source if they have access to the app, that won't be possible, as Lex Li also highlighted.
    The best you can typically do is to minify the code and not ship source maps to make it harder to read.

    Alternatively, to ensure that only authenticated users can access your JS files, you might consider employing a web server that exclusively delivers these files to authenticated users. This is in contrast to just using Azure Blob + CDN as is typical for the hosted JS of web applications.

     If the answer helped (pointed, you in the right direction) > please click Accept Answer

    0 comments No comments