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.
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:
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.
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 11 years ago.
Possible Duplicate:
Does HTML5 require clients to support JavaScript?
Would HTML5 API's work when Javascript is disabled in the web browser? Or after HTML5 becomes standard is it true that we would no longer be able to disable Javascript?
I wrote a dummy chrome extension, that uses javascript to display a alert window.
This still works when I disable javascript, which I thought would disable it. Shouldn't it? Or am I missing something?
It depends on what you mean by "HTML5 API".
If you mean it as the DOM hooks into different elements, such as video.play(), then yes, you'll need JavaScript enabled to use those features.
If instead you mean it as the new features of HTML or CSS such as input[type="email"] and the :valid pseudo-selector, then no, you wont need JavaScript enabled to use those features.
Most of the new HTML5 features are targeted towards improving the interactivity and usability of the web. Any user who decided to disable JavaScript does so with the understanding that they are disabling the vast majority of web interactivity.
For a developer, this means that the interactions should be layered on top of a solid foundation of quality content and data. If the user has JavaScript enabled, then they get the flashier, easier to use interface. If the user has JS disabled, then they get the generic static content replacement.
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.