Why do browsers provide an option to disable Javascript? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
It is just a noob question: why do browsers have a "disable javascript" function?
I am just curious and hunger for learning. Thanks!

If you're asking why some browsers might have Javascript turned off, it is a user setting in a browser. The user has the ability to decide whether they want to enable Javascript or not.
Users may choose to disable Javascript for either security or privacy reasons. It seems less common these days because more and more sites are not fully functional without Javascript enabled.

In my opinion, one reason could be some highly technical users may want full control over how they want their browsers to behave. Javascript is one part of browser behavior which some users may wish to control. Thus - it is a question of choice. Sometimes - some Javascript could be too annoying for some choosy techie users and they may wish to turn it off.
Thus - in addition to security and privacy, it is a choice that browsers offer to end users. However it is true that nowadays most sites hardly function without JS. But still there could be those plain old vanilla HTML sites around that may do without any client side scripting.
Regards

Related

Best way to use javascript in anchor tag [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
There are many ways to use JavaScript. When I use JavaScript with an anchor, I write code like this and I think this way is right.
Method One
But my co-worker uses JS like this.
Method Two
Is there a coding standard or are both methods correct?
DISCLAIMER: Inline JavaScript is, generally speaking, a bad idea, and 99% of the time you're much better off separating concerns, and using a library, such as jQuery, or whatever similar toolset that your framework of choice recommends.
Nonetheless, to answer your question, if you must use inline JavaScript, I recommend that you omit the "JavaScript:" keyword. It specifies a "pseudo-protocol," and is not necessary for modern browsers to interpret the code. It is a relic from the last decade, and there is a bug with some versions of IE:
"There is one (somewhat obscure) bug with the javascript protocol - in
Internet Explorer*, it will think you are leaving the page when you
click the link. If you are using window.onbeforeunload, then your
navigate-away message will appear at this time. For this reason alone,
we've stopped using the javascript protocol completely so we don't
have this bug show up because we forgot to check for it when we add a
navigate-away message to some page."
When do I need to specify the JavaScript protocol?
https://bytes.com/topic/javascript/answers/504856-javascript-pseudo-protocol-event-handlers
Both the ways are ok but in first way you should use a external JS file. Otherwise it is ok.
For small tasks and events second ways is good.

Dynamic Website Content without Javascript? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Being comfortable with Javascript, HTML5, and CSS3, allows me to achieve most anything I want to accomplish in a given design, however removing Javascript from the equation leaves little to offer in terms of dynamic content. Being that some users prefer to disable JavaScript, albeit this is exception rather than the norm, in such use cases, are there any alternative technologies that would (could) not be disabled, and thus allow for workaround-dynamic content to still be present in the absence of Javascript?
In order to satisfy these requirements the following criteria would have to be met:
(1) The technology has cross-browser compatibility with (nearly) all modern browsers.
(2) The technology would need to allow for user input on the website (such as text fields), which would then be sent sever-side for processing, then return data (such as a chunk of HTML).
(3) Then, this technology would also need to be able to take this chunk of HTML/data and add it to the page without a refresh (ideally, though a refresh my be able to be tolerated if necessary).
Doing my own due diligence, I have come up with part of an answer, though I am not sure about the feasibility of my approach, and thus would like to hear what you think about using server-sided scripting (like PHP) and HTTP-META-REFRESH, to achieve such a result.
Does such an approach sound feasible, or is PHP-scripting on the server side also have the ability to (going out on a limb here) be turned off by the user as well? If it can be turned off, furthermore, are there any other ways to send and receive data that can't be (or has a much less likelihood of being) turned off, then use this data to change the HTML of a given page similar to the way the "document.getElementById(id).innerHTML = new HTML" approach?
Server-side languages like PHP cannot be "turned off" by the user.
Using "http-meta-refresh" is not relevant. You cannot use that to simulate in any way the interactivity of JavaScript. It might meet point 1 (browser availability) but it has nothing to do with points 2 and 3.
Specifically, it cannot be used to issue POST requests (point 2) and doing a meta refresh refreshes the page. It misses point 3 entirely.
There is no way of achieving JavaScript-like functionality such that it cannot be turned off and works in all browsers. There is nothing remotely like this.

How to disable website for older browsers? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm using HTML5, CSS3, and other new technologies.
I want to prevent my users from using old browsers in a standard way.
How to detect old browsers in javascript or PHP?
How to show alert users properly?
This website provides a easy to use script that helps your users in a nice way to upgrade their browsers:
http://www.browser-update.org/
Include our small javascript notification on your website
Visitors with out-dated browser will be informed by a little, undisturbing bar, that his browser is not up-to-date and it is
recommended to update.
By clicking the bar, he will get to an info page with arguments why to change/update and some browser choices.
If the visitor ignores the advice, it won't appear again for some time.
It won't prevent the users from using your website, it will just notify them that they have an outdated browser and try to encourage them to update, and it does so in a discreet way.
By default, the script will give this message for a recommended set of old browsers (that automatically gets updated over time when browsers become too old), but you can also manually choose for which browsers the message will appear.
You're also able to customize the looks of the message.
Rather than diminishing peoples browsing experience by blocking them, consider progressive enhancement instead. While it may take a little more work it will be worth it. And as already suggested take a look at modernizr

Good resources for handling IE7-8 specific Javascript CSS bugs [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
After a week of coding finally have my site working across all browsers and mobile devices. I made the mistake of not viewing in IE8 and IE 7 until now.
Can anyone share some steps in resolving IE7-8 compatibility issues when using jQuery and CSS?
What are some first steps to try?
If a site isn't too complex does it make sense to do server side detection and serve up an IE only site?
There should be few if any issues in jQuery - thats one of the big benefits to using jQuery or a similar library in the first place. Chances are if there is a js issue then its something you wrote as opposed to something internal to jQuery.
In both cases the bets thing to do is simply know the majority of the big things that differ in support. the Quirksmode.org compatibility tables are good for this. If you know the differences in the first place you are going to be able to create solutions up front before you ever get to testing and avoid the issues. Beyond that test cross-browser early on in the process - not at the last minute.
Depends on what problems you are running into. There are a lot of resources, such as PositionIsEverything or HasLayout, on the web complaining about & explaining different IE bugs (peekaboo, double margin etc).
It is useful to use a tool such as IETester to see your page on actual IE versions.

subverting adblock detection? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Several questions concern how to detect adblock use, but I couldn't find any that explained how to subvert detection?
Personally, I don't find it appropriate to bypass ad blocking detection, though I know that others may have different viewpoints. If a site doesn't want to offer you their content without you displaying their ads (perhaps their only way of paying for the site), then that seems to me to be their prerogative and if they go to the trouble of detecting the ad blocking, then it seems that that is their right.
That said, there are a number of different ways that they could be detecting that you're blocking their ads. Some could be complicated enough that you couldn't simulate that you had the ads when you didn't. For example, if you are blocking flash and they are trying to communicate with a flash object to verify that it's there, you'd have to simulate that it was really there and that could be quite difficult. If their detection logic was a lot simpler, then it might be possible to fool it with some sort of simulation. But, I suspect this would just be an arms race and if any significant number of folks foiled their blocking detection, they'd just make it more sophisticated.
In that case, all you could do it try to figure out how to patch their actual javascript detection code directly to make it return a false answer. How you would do that would vary from one site to the next and any solution would have to be coded for a specific site. I wouldn't recommend it.

Categories