添加Content-Security-Policy / content = default-src https后,JS无法正常工作:

时间:2018-06-15 15:23:55

标签: javascript https content-security-policy

嗨,我的网站工作正常(bureaudonald.com)。添加<meta http-equiv="Content-Security-Policy" content="default-src https:">

后,只有一个JS不再工作了

这是代码。有人知道我需要改变什么才能让它发挥作用吗?

function GetValue()
	{
		var myarray= new Array(
			"Why are we doing this?",
			"Why are we making this?",
			"Why would we add this?",
			"etc"
			);
	    var random = myarray[Math.floor(Math.random() * myarray.length)];
	   document.getElementById("message").innerHTML=random;
	}
	<!-- WHY -->
	<div class="main why_loader" id="whysection">	
	
		<section data-navlink="navwhy">
		 
		<div class="why">
		
			<div class="why_content">
			
				<div class="why_field">
					<span class="why_title" id="message">Ask Why!<br/>And Ask it Again<br/>And again</span>
				</div>								
			
				<div class="why_button">
					<button class="why_btn" onclick="GetValue();">Ask Why Again!</button>
				</div>
			
			</div>
			<h2>&nbsp;</h2>				
		</div>
					
		</section>
		
	</div>

0 个答案:

没有答案