简体   繁体   中英

Is there anyway to hide partial/element of a html source when viewing?

I know this is not possible in direct. Just checking if there is any work-around, or :source specific api's.

Anyone know a method or a trick to hide part of the html source code when view from view-source code option in the browser?

eg view-source: https://www.someurl.com/

I need to hide part of a source code, for an example a javascript tag or a div element.


Any possibility of achieving it by javascript?

Idea is not to secure the script, but to ignore when code copying.

I know what's come to client will download to local, but as I mentioned this is not to SECURE a script. But just to ignoring it in code copying .


Thanks!

You can't hide, you can obfuscate

You can always access what is going over the web. In javascript, if you want people to not be able to figure out what is going on, you can use an obfuscator to make it a bit more difficult. But you can not hide it entirely.

I haven't used an obfuscator for javascript myself at this point, but a quick google search turned up this one . I'm sure you can find both free and commercial alternatives.

Anything and everything which is downloaded by the user's browser is his/her to keep . You cannot "hide" any client-side code from the user. What you can do is you can obfuscate or minify or use the javascript packer to make it harder for the user to figure out the logic of your code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM