2013-08-26 14 views
5

私はphonegap 2.9.0を使用してWindows 8プロジェクトを作成し、その中でJQueryモバイルライブラリを使用しようとしました。しかし、次のセキュリティ例外が発生します。どのようにこれを解決するか?Windows 8 PhonegapアプリケーションJQuery Mobile Security例外

Exception was thrown at line 4, column 7009 in ms-appx://c6a291ce-903f-47ab-b167- cb8378ffb051/www/libs/jquery.core/jquery-1.9.1.min.js 

0x800c001c - JavaScript runtime error: Unable to add dynamic content. A script attempted to inject dynamic content, or elements previously modified dynamically, that might be unsafe. For example, using the innerHTML property to add script or malformed HTML will generate this exception. Use the toStaticHTML method to filter dynamic content, or explicitly create elements and attributes with a method such as createElement. For more information, see http://go.microsoft.com/fwlink/?LinkID=247104. 

If there is a handler for this exception, the program may be safely continued. 
+0

同じ質問は、しばらく前に尋ねた: http://stackoverflow.com/questions/14471362/javascript-runtime-error-unable-to-add-dynamic-content –

+0

ありません、それは同じことではありません。それはユーザー定義のJavaScriptです。これは、JQuery Mobileライブラリ自体から来ています。 – msrameshp

+0

誰でも助けてくれますか? – msrameshp

答えて

2

私はちょうど同じ問題に遭遇しました。この問題は、文字列から要素を作成するときに、WinJSのセキュリティモデルでJQueryのDOM操作が許可されないなどの問題があるようです。 .html()メソッドを使用します。

詳細については、以下を参照してください:要するに http://blogs.msdn.com/b/windowsappdev/archive/2013/04/01/windows-store-app-support-in-jquery-version-2-0.aspx

http://net.tutsplus.com/tutorials/javascript-ajax/building-windows-store-applications-with-jquery-2-0/

を賢い人は、jQueryの2.0でこれに修正を生産しています。

JQuery 2.0を使用していますが、JQuery Mobileでも使用できますか?私はそれをまだ決定していないので、おそらく.html()メソッドを使用するのではなくdom要素を完全に構築して取り付けることに目を向けるでしょう。

しかし、私はまだこれらのアプローチを試していないので、その有効性を保証することはできません。

+0

あなたのご意見ありがとうございます。私は既にJQueryの問題をJQuery 2.0に置き換えてJQueryの問題を解決しましたが、JQuery Mobile 1.3.2と1.4.0の両方で同じ問題が発生しますバージョン。 – msrameshp

+0

どうすれば回避できますか? – d0001

+0

遅くなりましたが、価値があるものについては、.html()を使用して放棄し、DOMコンポーネントを追加して追加してください。 –

関連する問題