Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / HTML5

Custom jQuery for Windows 8

5.00/5 (1 vote)
25 Oct 2012CPOL 11.3K   115  
jQuery customised version to be used with Windows 8.

Introduction

With Windows 8 we get an ability to write HTML5 apps in JavaScript. With JavaScript comes a vast library of code already written for we. jQuery is one such useful library. jQuery can run under WinRT and apps will work fine while development. But none of the apps will get approved on the marketplace because jquery uses some code which seems malicious to windows 8 testers. For example Dynamic HTML injection. Thus i have created a customized version  of jQuery which passes windows 8 test. 

Using the code 

Step 1: Include jqueryWin8.js file in your project. 

Step 2: Type this <div> in your HTML file 

HTML
<div id="test"><link/><table></table><a href='http://www.codeproject.com/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/></div> 

Include jqueryWin8.js in your HTML file. 

HTML
<script type="text/javascript" src="js/jqueryWin8.js"></script>   

Step 3: Use jQuery $() and other features in your app. 

Step 4: Profit  

The code works because instead of using div.innerHTML() function we are explicitly making a "test" div  which jQuery uses to test for some support. 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)