65.9K
CodeProject is changing. Read more.
Home

Custom jQuery for Windows 8

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1 vote)

Oct 25, 2012

CPOL
viewsIcon

11341

downloadIcon

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 

<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. 

<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.