How to automatically allow blocked content in IE?

JavascriptHtmlInternet Explorer

Javascript Problem Overview


I am using below code for sample menu.

    <html>
<head>
<title>Tree Demo</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.jstree.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
/* 		 $("#main").jstree({
		        "themes" : {
		            "theme" : "default",
		            "dots" : false,
		            "icons" : false
		        },
		        "plugins" : [ "themes", "json_data", "ui"],
		        "json_data" : {
		            "ajax" : {
		                "url" : "jsondata.json",
		                "data" : function (n) {
		                    return { id : n.attr ? n.attr("id") : 0 };
		                }
		            }
		        }
		});
		 
		 $("#main").bind("open_node.jstree", function (e, data) {
			         // data.inst is the instance which triggered this event
			         console.log(data);
			         console.log($.data(data.rslt.obj[0],"folder_name"));
		});
		$("#main").bind("select_node.jstree", function (e, data) {
	         // data.inst is the instance which triggered this event
	         console.log(data);
	         console.log($.data(data.rslt.obj[0],"folder_name"));
		}); */
		
		 $("#main1").jstree({
		        "themes" : {
		            "theme" : "default",
		            "dots" : false,
		            "icons" : false
		        },
		        "plugins" : [ "themes", "html_data"]
		});
 
	});
</script>
</head>
<body>
	<div id="main1">
		<ul>
			<li><a href="javascript:void(0)">Home Folder</a>
				<ul>
					<li><a href="javascript:void(0)">Sub Folder1</a></li>
					<li><a href="javascript:void(0)">Sub Folder2</a></li>
				</ul></li>
			<li><a href="javascript:void(0)">Shared Folders</a>
				<ul>
					<li><a href="javascript:void(0)">Shared Folder1</a></li>
					<li><a href="javascript:void(0)">Shared Folder2</a></li>
				</ul></li>
		</ul>
	</div>
	<div id="main">
	</div>
</body>
</html>

when i run the above code in IE browsers it shows top of the page(below the URL bar) like

" To help protect your security , internet explorer has restricted this webpage from running scripts or Activex controls that could access your computer. click for options.. "

when i rightclick and click allowed blocked content, it runs.but i want without this popup message i need to run the code...how can i automatically run this one?...

Javascript Solutions


Solution 1 - Javascript

There is a code solution too. I saw it in a training video. You can add a line to tell IE that the local file is safe. I tested on IE8 and it works. That line is <!-- saved from url=(0014)about:internet -->

For more details, please refer to https://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx

<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html lang="en">
    <title></title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <script>
        $(document).ready(function () {
            alert('hi');
 
        });
    </script>
</head>
<body>
</body>
</html>

Solution 2 - Javascript

I believe this will only appear when running the page locally in this particular case, i.e. you should not see this when loading the apge from a web server.

However if you have permission to do so, you could turn off the prompt for Internet Explorer by following Tools (menu) → Internet OptionsSecurity (tab) → Custom Level (button) → and Disable Automatic prompting for ActiveX controls.

This will of course, only affect your browser.

Solution 3 - Javascript

You have two options:

  1. Use a Mark of the Web. This will enable a single html page to load. It See here for details. To do this, add the following to your web page below the doctype and above the html tag:

    <!-- saved from url=(0014)about:internet -->

  2. Disable this feature. To do so go to Internet Options->Advanced->Security->Allow Active Content... Then close IE. When you restart IE, it will not give you this error.

Solution 4 - Javascript

If you are to use the

<!-- saved from url=(0014)about:internet -->

or

<!-- saved from url=(0016)http://localhost -->

make sure the HTML file is saved in windows/dos format with "\r\n" as line breaks after the statement. Otherwise I couldn't make it work.

Solution 5 - Javascript

Steps to configure IE to always allow blocked content:

  1. From Internet Explorer, select the Tools menu, then the Options...
  2. In the Internet Options dialog, select the Advanced tab...
  3. Scroll down until you see the Security options. Enable the checkbox "Allow active content to run in files on My Computer".

enter image description here

  1. Close the dialog, and quit Internet Explorer. The changes will take effect the next time you start IE.

The Blocked Content is a security feature of Windows XP Service Pack 2. If you do not have SP2 installed, then you will never see this message.

From: How To Allow Blocked Content on Internet Explorer

Solution 6 - Javascript

That's something I'm not sure that you can change through the HTML of the webpage itself, it's a client-side setting to tell their browser if they want security to be high. Most other browsers will not do this but from what I'm aware of this is not possible to stop unless the user disables the feature.

Does it still do what you want it to do after you click on 'Allow'? If so then it shouldn't be too much of a problem

Solution 7 - Javascript

Alternatively, as long as permissions are not given, the good old <noscript> tags works. You can cover the page in css and tell them what's wrong, ... without using javascript ofcourse.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRavichandran JothiView Question on Stackoverflow
Solution 1 - JavascriptRay ChengView Answer on Stackoverflow
Solution 2 - JavascriptandybView Answer on Stackoverflow
Solution 3 - JavascriptSteve RoweView Answer on Stackoverflow
Solution 4 - JavascriptharryggView Answer on Stackoverflow
Solution 5 - JavascriptEddyView Answer on Stackoverflow
Solution 6 - JavascriptJakeJView Answer on Stackoverflow
Solution 7 - JavascriptcommonpikeView Answer on Stackoverflow