简体   繁体   English

a href onclick在Windows Phone Cordova应用中不起作用

[英]a href onclick not working in windows phone cordova app

I have used winstore-jscompat.js for js fix. 我已使用winstore-jscompat.js进行JS修复。 below code generate sub categories. 下面的代码生成子类别。 But it doesnt call parseSubCategory function. 但是它不调用parseSubCategory函数。

            $.each(category.sub_categories, function(index2, subcategory) {
                   var subCatName = subcategory.name;
                   $("#test-listview" + index).append('<li><a onclick=\"parseSubCategory(' + subcategory.id + ',\'' + subCatName + '\');\" href="#product_List">' + subcategory.name + '</a></li>');

             });

Edit: 编辑:

This is working fine on ios and android but not in windows mobile phone 这在ios和android上工作正常,但在Windows Mobile手机上无法正常工作

Issue happened because of pulling in potentially unsafe content from an external sources. 发生问题是由于从外部来源提取了潜在的不安全内容。 We can modify jquery source and ignore this. 我们可以修改jquery源并忽略它。 I have found the solutions here. 我在这里找到了解决方案。

https://www.incloud.de/2012/08/windows-8-using-jquery-for-app-development/ https://www.incloud.de/2012/08/windows-8-using-jquery-for-app-development/

It works for me. 这个对我有用。

Customize the content security policy in the meta tag: 在meta标记中自定义内容安全策略:

http-equiv="Content-Security-Policy"

As needed. 如所须。 Add unsafe-inline to default-src to enable inline JavaScript. unsafe-inline添加到default-src以启用嵌入式JavaScript。

For details, see http://go.microsoft.com/fwlink/?LinkID=617521 有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkID=617521

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM