This question already has answers here:
can view source be disabled by a website?
(6 answers)
Closed 8 years ago.
Actually I want to protect my source code of my website from everybody.
so I want to disable all sources of finding the code like: Ctrl+U, Ctrl+Shift+I,F12 and menu of browser.
It is impossible to hide your source code. You could install a script to prevent right-clicking or encrypt your code with JavaScript, but that won't stop anyone that knows anything about web development from finding it.
This will never work, and your effort is better spent elsewhere.
At the very least, a user can use a web proxy like Fiddler to easily retrieve the source code.
Related
This question already has answers here:
How to handle JavaScript being disabled in AngularJS
(2 answers)
Closed 8 years ago.
I have learned angular.js, and it's awesome , i'm impressed. i want to use it in my website, but what if our some of user has disabled JavaScript on there browser, they should still gonna see my website content ?????. i'll appreciate your help.
In most cases when js is required, you should add noscript which will be displayed when js is disabled. In that tag you need to warn user that he/she should enable js.
In addition to other answer, I am quoting from Angular book:
Not everyone’s browser supports JavaScript. Let everyone see all of your content and use your app without needing to execute code in the
browser.
The world has changed since these concepts were born. Point #1 is no
longer true for any interesting population. If you’re running a
browser without JavaScript, you’re rele‐ gated to sites created in the
1990s
Or make a div with a warning/notice text (maybe in center of page), and hide that div in js (first thing in your code)
So, if the user does not have js enabled, they will see the nice warning
This question already has answers here:
How to hide html source & disable right click and text copy?
(21 answers)
Closed 9 years ago.
I wonder how to hide the source code of a web page. This is an example of webpage with hidden source (right click -> view page source). Any ideas or suggestions?
UPDATE I fully agree, that fully hiding HTML source is impossible, otherwise the browser could't parse it. Using tools like FireBub etc. will show you the source. The interesting in the example above in that on "show source code" the displayed page does not match the output.
Now I understand it is just another kind of technology used here - XSLT.
Thanks for your replies!
If your page is generated dynamically (by Javascript), then it using View Source will not show anything (or very little, anyway). I suspect that's how your example is doing it.
Bear in mind that any page generated this way will still be visible by using a code inspector such as Firebug. So as #Brad M says, this will only stop people who don't really know what they're doing.
If you build the entire page in Java or Flash (or something similar like Silverlight I guess) then it's a lot harder for someone to find out what the source code is (though Java is pretty easy to decompile)
There is no way to hide your code from a client that must execute the code.
Your example just did some trick to prevent right-clicking and stuff. But eventually you can get your way around.
For interpreted language such as javascript, the following adage is true.
" Lock on the door is only for the one who don't care. If there comes thief, most of the time he is already prepared."
All you can do to prevent is obfuscating your code. That will prevent it for some time. But remember, if they are going to crack it, it is not unstoppable. The basic thing to remember is: your script is going to run on the client side and is "INTERPRETED" by browser. In these days, when there are few tools that can create source code from compiled file, the thought of hiding javascript code is even not thinkable. This How can I obfuscate (protect) JavaScript? can help you on how to do it.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to select all text in a textbox and copy it to clipboard using JavaScript/jQuery?
Copy text to the client’s clipboard using jQuery
I need a javascript, jquery function for copy to clipboard functionality. I know following code but it works in IE only:
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
I see some tutorials which are suggestion some swf files. I have used some of them like http://www.steamdev.com/zclip/ but it is not working.
Please suggest solution to it.
There isn't any cross-browser way to copy data to the clipboard via javascript (it's regarded as a security hole) - it can be done with the assistance of a small flash applet, but this of course isn't fully cross platform.
One of the cheats I've used before is to create a prompt with a default value in which makes it slightly easier for the user to copy-and-paste the information without having to highlight it in the page. But this doesn't really solve the problem. All you can do is make the copy-and-paste as little effort as possible.
The mainstream way of doing this is via a SWF object. ZeroClipboard is a neat project which deals with this.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to detect if JavaScript is disabled?
Is it possible to detect whether javascript has been disabled if so redirect to another page?
My application is being developed with JSPs, as I am using a lot of fancy javascript stuff in my application.
Thanks in Advance
Dean
You can use the <noscript> tag:
http://www.boutell.com/newfaq/creating/detectjs.html
Know this is an old thread, but just thought it add my own solution. I have javascript controlled <div> and on a browser where javascript is disabled, none of these are show so:
Have a standard <div> in center of page saying “please enable javascript to view or click here for non javascript page”
Set the z-value to -1
Have all javascript controlled <div> and set with a white/whatever background and a z-index value to 0 or higher
The javascript controlled <div> will cover the message if enabled, and show it if not.
Hope that this gives one or two of you a few ideas. Although this was specifically for my site, you may find that thinking out the box may help you too.
This question already has answers here:
DOM attribute change debugging
(4 answers)
Closed 9 years ago.
I have a large website in development with a large amount of JS in different files. I have come across an issue where something is removing a class from the DOM. I can see it when I view source but not in Firebug.
Normally I would place some alerts/console.log calls with the hasClass value but because I have no idea where to start I wanted to know if I can trace the change back when it occurs somehow?
Denis
Firebug lets you set a breakpoint and single-step through your code. This should make it clear where the issue is happening.
that specific class name must be in use in that hidden function that remove it, right?
so either grep for it on posix-based system, or, if you are using Win system, use your IDE "search-in-files" function to trace that modification.