Enable script run in web browser using java script codes - javascript

I designed a web page which contains some javascripts, but when I'm running the page in certain browsers like internet explorer my scripts get blocke and the browsers asks for manual enabling of the script in that browser
I need java script or jquery code for enabling script run in any browser automatically. Can anyone help me please?
Thank you

It is impossible for a website to turn on JavaScript if it is disabled in the browser.
Design your site with progressive enhancement and unobtrusive JavaScript in mind.
If, by "certain browsers like internet explorer", you mean "Internet Explorer will not run my code" (as opposed to "Browsers wil JS turned off will not run my code") then you may just need to learn how to write cross-browser compatible code.
Without a specific example of code that does not work (along with the specific error messages you receive), that topic is too broad to cover on StackOverflow.

Sounds like you are running the website locally, ie opening the file not serving it from a web server. Try running a local web server or hosting your site on a free online service and as long as the browser doesn't have JavaScript disabled the messages shouldn't show up.

Related

JavaScript won't run on Internet Explorer within web browser control

I am attempting to develop an application in VB that uses a web browser to go to a specific site. The problem is that the JavaScript applet on the website won't load through the internal browser. It works on both Edge and Chrome, but not through Visual Studio or Internet Explorer. I have scoured the internet options, making sure that it can run scripts. I also enabled the ability for the web browser to be used as a scripting object in my code. I have run Windows updates as well. I guess I'm looking for 1 of 2 solutions. Either a way to fix my browser so I can test and use my application or a way to change the default browser in Visual Studio itself (I already changed the external editor to Chrome, but it had no effect on my application). Can someone help me? Is there a way to embed the user's default browser into my application so that other users don't run into the same problem if I ever distribute my application?
-Verified that scripts and ActiveX were enabled in my internet options
-Attempted to change internal browser
-Ran Windows updates
No change.

Open a link in a specific browser

I have a web application which runs on all browsers but there is a link to another application which can only run in Internet Explorer. How I can force browser to open this link in a new IE browser when my application running in other browsers such as chrome? Should this piece of code written in server side or client side?
You can't force the client to launch a different browser like you're asking.
What I would suggest is to have your application test when it is launched to see if it is currently running in IE. If it isn't, it should issue an error message stating something like: "This application requires Internet Explorer. Please reopen in IE." Then have it stop there.
Most probably, using resources of JavaScript and HTML5, you cannot run applications on end user's computer. Moreover, it sounds incorrect in terms of security and usability.
The best thing you can do is to write a message like "Open this link in IE" near your link.
At the final page, you can detect a user's browser and, in case it is not an IE, show him a message "Unfortunately, this web-page works only with IE. Please, open it in IE".
By the way, could you tell us, why your page is not working in other browsers? Probably, we will find a proper answer there.

HTML5 website compatibility in Internet Explorer

I was going through a simple HTML5/CSS3 tutorial to build a basic website.I closely followed the tutorial to make myself understand the newly added tags use and developed what was taught online step-by-step.
However, the demo of the site I was creating worked fine on Internet-Explorer8 but when I completed my own development, though it worked fine in Chrome and Firefox but it didn't pick any design when I tried run it on Internet-Explorer8.
This however I understand is due to old versions of IE's not supporting newly added elements of HTML5 thus added a script HTML5shiv.js.
This should work fine however IE8 kept popping up the dialog box displaying that : It blocked some Active Content due to security reasons and if required, you can allow them to dosplay. This was never the case with the demo version of the website that I was making.
However, when I allowed the ActiveX controls in the IE8, everything worked fine.
The issue with me now is that if any of my website's user has disabled ActiveX-Controls in IE6,7 or 8, then my website would loose it''s designed structure. How can I get through it?
I assume you are loading html5shiv.js from a separate domain, if so try downloading it and hosting it with the rest of your website. This should solve your problem.
If you're developing your website locally (i.e. directly opened from a file on your computer), that can also cause this problem.
Update to users comment:
Hosting it should solve it. Instead of buying hosting though you could simply host on your localhost, to do that look into using something such as WAMP, or MAMP for Mac.
Alternatively, you can add <!-- saved from url=(0017)http://localhost/ --> to the top of your document which should disable the security policy. You can read more about that here.

How to run and install EXE file from the web browser using JS without user approve

I want to implement in my website a functionality like in google chrome website, that a user click on a website form and the file will auto download and install itself without any user approve or interferance.
Here is the google chrome website: https://www.google.com/chrome/index.html?hl=iw
I know that they use clickonce technology by ms for IE and oneclick technology by google for all other browsers, but there is a way that i can also use thier code and their technology to run my own files?
I know they also use google update task that runs on windows background but I dont know how to use it with my own files.
As far as I know, this functionality is possible only if the client has .NET Framework (version 4 I guess), and your domain is in the trusted domains list of the user's preferences for this functionality. So this would work only on Windows platform, and your domain need to be added to the mentioned list (what is unlikely to happen I guess). A short answer is NO, you can't do this, if you are not a corporation like Google.
Bonus: You don't need it, users do not like to be tricked, they want to know everything that happens with they computer.
For security reason, you cannot access file from your website. What would happen if a user open a website, and they got some programs installed in their machine? That's gonna be serious problem

Reading / Writing files in Javascript - IE6

I need a database storage system for Javascript where the state can be maintained on the local disk.
Here comes the spanners in the works :-
It only needs to support Internet Explorer but the minimum version must be IE6
Files need to be written so they can be read in again later (upon closing and re-opening of browser)
There can be no web server (unless it's extremely easy to distribute and does not require a install) since the HTML pages will be distributed on USB.
Does anyone know of any solutions that might help here?
Have fun playing with userData. Apparently it does what you want in IE6/7
Then localStorage for IE8/9
Or you can use the heavier store.js which does the feature detection for you and apparently works in IE6+.
It should work in IE9 but no garantuees. I would recommend store.js as it's easier for maintenance and just works out of the box. You can also support other browsers that way.
I don't know if it's supported in IE6, but JScript appears to have some level of support for this through FileSystemObject.
var fso = new ActiveXObject("Scripting.FileSystemObject");
var a = fso.CreateTextFile("c:\\testfile.txt", true);
a.WriteLine("This is a test.");
a.Close();
According to Write binary data with FileSystemObject write(), ADODB.Stream appears to be an alternative.
For strictly local IE work use HTA Applications. Then you can access local resources (text files, ADO databases) without security problems.
try to read this post: Read/write to file using jQuery
Hope this helps.
I would suggest that you not try to read/write using JavaScript but instead head down the road of embedding a small web server on the USB drive. I did this for an app once and it worked out well. I used the Cassini web server.
I created two projects in visual studio. First, I created an ASP.Net web site to read/write from an SQLite database. This site displayed all my content and was built just like any other ASP.Net site. Second, I created a Windows Forms application that hosted the Cassini web server and presented the user with a form that contained a single web browser control. This made the user experience very simple ... they just clicked MYAPP.EXE from the root of the USB drive and the form opens, starts the web server, and navigates the browser control to the start page of the web site.

Categories