I'm using Ionic v1 and testing in Chrome (ionic serve) and View App (ionic upload).
我正在使用Ionic v1并在Chrome(离子服务)和View App(离子上传)中进行测试。
I included this script in my index.html
我在index.html中包含了这个脚本
<script src="https://s7.addthis.com/js/300/addthis_widget.js#pubid=foo&async=1"></script>
And added the https://github.com/thisissoon/angular-addthis directive.
并添加了https://github.com/thisissoon/angular-addthis指令。
<sn-addthis-toolbox class="addthis_custom_sharing"
data-share="{
title: thing.title,
url: 'https://myurl/' + thing.id,
description: 'Check out my thing.'
}">
<a href class="addthis_button_email"></a>
<a href class="addthis_button_facebook"></a>
<a href class="addthis_button_twitter"></a>
<a href class="addthis_button_google_plusone_share"></a>
</sn-addthis-toolbox>
When viewing my ionic app in Chrome or firefox everything looks great. When i push to Ionic view my addthis buttons are missing. In Chrome Dev Tools, things look great with any responsive view or device.
在Chrome或firefox中查看我的离子应用程序时,一切看起来都很棒。当我按下Ionic视图时,我的addthis按钮丢失了。在Chrome开发者工具中,任何响应式视图或设备都可以看起来很棒。
Any direction would be helpful here. How would i see error messages in Ionic view?
任何方向在这里都会有所帮助。我如何在Ionic视图中看到错误消息?
Why is the addthis.com js widget not working on mobile device?
为什么addthis.com js小部件无法在移动设备上运行?
TIA.
EDIT: I added the https and that got things a step further. (thanks to adamdport)
编辑:我添加了https,这使事情更进一步。 (感谢adamdport)
Now seeing Failed to load file://m.addthisedge.com/live/boost/foo/_ate.track.config_resp resource: NET ERR_FILE_NOT_FOUND
现在看到无法加载文件://m.addthisedge.com/live/boost/foo/_ate.track.config_resp资源:NET ERR_FILE_NOT_FOUND
and
Uncaught TypeError: Cannot read property 'split' of null at r (https://s7.addthis.com/js/300/addthis_widget.js:2:44431) at e.exports (https://s7.addthis.com/js/300/addthis_widget.js:2:211271) at https://s7.addthis.com/js/300/addthis_widget.js:2:224158 at https://s7.addthis.com/js/300/addthis_widget.js:2:361724 at o (https://s7.addthis.com/js/300/addthis_widget.js:2:223353) at https://s7.addthis.com/js/300/addthis_widget.js:2:215504 at HTMLDocument.onReady (https://s7.addthis.com/js/300/addthis_widget.js:2:214257)
未捕获的TypeError:无法在r(https://s7.addthis.com/js/300/addthis_widget.js:2:44431)的e.exports上读取null的属性'split'(https://s7.addthis.com /js/300/addthis_widget.js:2:211271)访问https://s7.addthis.com/js/300/addthis_widget.js:2:224158,网址为https://s7.addthis.com/js/300/ addthis_widget.js:2:361724 at o(https://s7.addthis.com/js/300/addthis_widget.js:2:223353)https://s7.addthis.com/js/300/addthis_widget.js :HTMLDocument.onReady上的2:215504(https://s7.addthis.com/js/300/addthis_widget.js:2:214257)
on addthis_widget.js line 2
在addthis_widget.js第2行
FINAL EDIT and solution: The best way i learned to solve this problem was to hook up my Nexus 6p via usb, enable usb debugging, and https://developers.google.com/web/tools/chrome-devtools/remote-debugging/
最终编辑和解决方案:我学会解决此问题的最佳方法是通过usb连接我的Nexus 6p,启用USB调试,以及https://developers.google.com/web/tools/chrome-devtools/remote-debugging /
2 个解决方案
#1
1
I resolved your original question regarding why your script wasn't loading: it involved your usage of //
and switching between http
and https
. If your Ionic URL uses https://
, the //
in your script src will try to also retrieve your script using https
, and it might not load.
我解决了原始问题,说明为什么你的脚本没有加载:它涉及你使用//并在http和https之间切换。如果您的Ionic URL使用https://,则脚本src中的//将尝试使用https检索您的脚本,并且可能无法加载。
Since you've edited, I've pointed out that file://
will only work on your local file system. If you try to reference it from a server, it will still try to load resources from the client's machine.
自编辑以来,我已经指出file://只能在本地文件系统上运行。如果您尝试从服务器引用它,它仍将尝试从客户端的计算机加载资源。
If you need further help, I'd suggest posting another question.
如果您需要进一步的帮助,我建议发布另一个问题。
#2
1
First of all as Ionic view does not support all the third party plugin so you have to build it first and test in real device. But I am not sure this will work. Because Add this share on website not app and as you are developing an app so you have to think like an app developer not like web developer. When you share something from website it will post into the social app's website. But when you share something from app it will post into the social app.
首先,由于Ionic视图不支持所有第三方插件,因此您必须先构建它并在真实设备中进行测试。但我不确定这会奏效。因为在网站上添加此共享而不是应用程序,并且在开发应用程序时,您必须像开发人员一样思考应用程序开发人员。当您从网站分享内容时,它会发布到社交应用的网站上。但是,当你从应用程序分享内容时,它会发布到社交应用程序中。
So in my suggestion if Add This still work on your real device, though you should not use this because as you are using Ionic so you have to share on app.
所以在我的建议中,如果Add This仍然在你的真实设备上工作,虽然你不应该使用它,因为你正在使用Ionic所以你必须分享应用程序。
#1
1
I resolved your original question regarding why your script wasn't loading: it involved your usage of //
and switching between http
and https
. If your Ionic URL uses https://
, the //
in your script src will try to also retrieve your script using https
, and it might not load.
我解决了原始问题,说明为什么你的脚本没有加载:它涉及你使用//并在http和https之间切换。如果您的Ionic URL使用https://,则脚本src中的//将尝试使用https检索您的脚本,并且可能无法加载。
Since you've edited, I've pointed out that file://
will only work on your local file system. If you try to reference it from a server, it will still try to load resources from the client's machine.
自编辑以来,我已经指出file://只能在本地文件系统上运行。如果您尝试从服务器引用它,它仍将尝试从客户端的计算机加载资源。
If you need further help, I'd suggest posting another question.
如果您需要进一步的帮助,我建议发布另一个问题。
#2
1
First of all as Ionic view does not support all the third party plugin so you have to build it first and test in real device. But I am not sure this will work. Because Add this share on website not app and as you are developing an app so you have to think like an app developer not like web developer. When you share something from website it will post into the social app's website. But when you share something from app it will post into the social app.
首先,由于Ionic视图不支持所有第三方插件,因此您必须先构建它并在真实设备中进行测试。但我不确定这会奏效。因为在网站上添加此共享而不是应用程序,并且在开发应用程序时,您必须像开发人员一样思考应用程序开发人员。当您从网站分享内容时,它会发布到社交应用的网站上。但是,当你从应用程序分享内容时,它会发布到社交应用程序中。
So in my suggestion if Add This still work on your real device, though you should not use this because as you are using Ionic so you have to share on app.
所以在我的建议中,如果Add This仍然在你的真实设备上工作,虽然你不应该使用它,因为你正在使用Ionic所以你必须分享应用程序。