Implement A Jquery Cross-Browser Solution

Date Published: 26/04/2020 Published By: JaiSchool

We should use Jquery CDN to reduce the execution time. But sometimes the firewall creates a problem by blocking it. In this case, our Jquery code won't work. And now, We need a cross-browser solution.

To implement a cross-browser solution in the project link both Jquery CDN & file (you can download it from the official website) in the head section. And also the code, given below. Replace jquery.js from your file.

After adding cross browser solution code, if firewall blocks CDN or any other issues occur then your linked Jquery file will execute.

Jquery cross-browser solution code

<script>
	window.jQuery || document.write("<script src='jquery.js'><\/script>");
</script>

Example:-

<head>
	<title>Jquery</title>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
	<script src="jquery.js"></script>
	<script>
		window.jQuery || document.write("<script src='jquery.js'><\/script>");
	</script>
</head>

Publish A Comment

Leave a Reply

Your email address will not be published. Required fields are marked *