Reputation: 2138
I am developing a web application in Struts2 (JSP).
I am using lot of Javascripts in my pages for dynamic contents like prompts, pop ups, menu bar, etc.
In most of the systems Javascript is blocked by default. This is creating problem like every time while I load my pages, I have to click on allow access to scripts.
In the pages with prompts, I have to give allow access to scripted window on each time when I open that page.
These will irritate the user who will use the application, and I have to use these prompts and scripts (which are highly required).
Is there any way to turn off the automatic script blocking by coding or by any other manner?
Actually what I want is user should not have to face the difficulty to always click allow content.
Upvotes: 1
Views: 529
Reputation: 807
Seems like you develop your application under https and load javascript resources from http. In that case browser will ask you to allow scripts execution. To prevent such questions from browser - load all resources (javascript, css, images) from the same protocol.
For example, to load jQuery I use this link: //ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
If you do not specify protocol to load resources - browser will use protocol from the page.
Upvotes: 1
Reputation: 943969
Browsers do not block scripts by default. If the user has disabled scripting or is running some script blocking software then (as a page author) you cannot bypass it.
If it was possible, the option would be "Disable scripting unless the page author really, really wants it" and lots of authors would think "I really, really want visitors to see my intrusive advertising that spins and shouts at them". (As options go, that wouldn't help the user much!)
You should follow the design principles of progressive enhancement and unobtrusive JavaScript.
If you are dealing with a controlled environment (which is plausible if in most of the systems java script is blocked by default) then you may be able to configure the systems to allow JS for the site. This would involve acting as a system administrator rather than a page author. How you do this would depend on the browser / third-party script blocking software. In Internet Explorer, for example, you might place the site in the Intranet Zone and allow JS for all sites in that zone.
Upvotes: 4
Reputation: 6857
There is no way for a web page to override a browser that does not allow Javascript to be executed (that would defeat the point of having an option to disable Javascript).
Upvotes: 4