How to hide JS files publicly from the browser?

Deshmukh, Vijit 516 Reputation points
2023-12-06T08:48:31.2433333+00:00

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,920 questions
{count} votes

Accepted answer
  1. ajkuma 26,721 Reputation points Microsoft Employee
    2023-12-15T18:11:31.43+00:00

    @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

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Lex Li (Microsoft) 5,662 Reputation points Microsoft Employee
    2023-12-06T11:28:08.1466667+00:00

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.