huangxiaojing 4 years ago
parent
commit
27adfecfcd
3 changed files with 20 additions and 0 deletions
  1. 1 0
      screenIos/WXtrialInterface.html
  2. 1 0
      screenIos/websocket.js
  3. 18 0
      screenIos/workerFakeDom.js

+ 1 - 0
screenIos/WXtrialInterface.html

@@ -112,6 +112,7 @@
 		<span id="user_ref_id">www.androidsCloud.com</span>
 	</div>
 	<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
+	<script type="text/javascript" src="workerFakeDom.js"></script>
 	<script type="text/javascript" src="jquery-1.11.0.min.js"></script>
 	<!-- ffm软解 -->
 	<script type="text/javascript" src="helper.js"></script>

+ 1 - 0
screenIos/websocket.js

@@ -1,4 +1,5 @@
 self.importScripts("helper.js");
+self.importScripts("workerFakeDom.js");
 self.importScripts("jquery-1.11.0.min.js");
 self.importScripts("jquery-weui.min.js");
 var parameters = GetRequest();

+ 18 - 0
screenIos/workerFakeDom.js

@@ -0,0 +1,18 @@
+var document = self.document = { parentNode: null, nodeType: 9, toString: function () { return "FakeDocument" } };
+var window = self.window = self;
+var fakeElement = Object.create(document);
+fakeElement.nodeType = 1;
+fakeElement.toString = function () { return "FakeElement" };
+fakeElement.parentNode = fakeElement.firstChild = fakeElement.lastChild = fakeElement;
+fakeElement.ownerDocument = document;
+
+document.head = document.body = fakeElement;
+document.ownerDocument = document.documentElement = document;
+document.getElementById = document.createElement = function () { return fakeElement; };
+document.createDocumentFragment = function () { return this; };
+document.getElementsByTagName = document.getElementsByClassName = function () { return [fakeElement]; };
+document.getAttribute = document.setAttribute = document.removeChild =
+  document.addEventListener = document.removeEventListener =
+  function () { return null; };
+document.cloneNode = document.appendChild = function () { return this; };
+document.appendChild = function (child) { return child; };