a href onclick not working in windows phone cordova app

◇◆丶佛笑我妖孽 提交于 2020-01-14 04:25:06

问题


I have used winstore-jscompat.js for js fix. below code generate sub categories. But it doesnt call parseSubCategory function.

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


回答1:


Issue happened because of pulling in potentially unsafe content from an external sources. We can modify jquery source and ignore this. I have found the solutions here.

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

It works for me.




回答2:


Customize the content security policy in the meta tag:

http-equiv="Content-Security-Policy"

As needed. Add unsafe-inline to default-src to enable inline JavaScript.

For details, see http://go.microsoft.com/fwlink/?LinkID=617521



来源:https://stackoverflow.com/questions/33735325/a-href-onclick-not-working-in-windows-phone-cordova-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!