我的 addthis 工具箱 JavaScript 小部件在移动设备上不存在

My addthis toolbox JavaScript widget not present on mobile device

我正在使用 Ionic v1 并在 Chrome(离子服务)和查看应用程序(离子上传)中进行测试。

我在 index.html

中加入了这个脚本
<script src="https://s7.addthis.com/js/300/addthis_widget.js#pubid=foo&async=1"></script>

并添加了 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>

在 Chrome 或 firefox 中查看我的离子应用程序时,一切看起来都很棒。当我按下 Ionic 视图时,我的 addthis 按钮丢失了。在 Chrome 开发工具中,任何响应式视图或设备看起来都很棒。

任何方向在这里都会有所帮助。我如何在 Ionic 视图中查看错误消息?

为什么 addthis.com js 小部件无法在移动设备上运行?

TIA。

编辑:我添加了 https,这让事情更进一步了。 (感谢 adamdport)

现在看到加载文件失败://m.addthisedge.com/live/boost/foo/_ate.track.config_resp 资源:NET ERR_FILE_NOT_FOUND

Uncaught TypeError: 无法读取 属性 'split' of null 在 r (https://s7.addthis.com/js/300/addthis_widget.js:2:44431) 在 e.exports (https://s7.addthis.com/js/300/addthis_widget.js:2:211271) 在 https://s7.addthis.com/js/300/addthis_widget.js:2:224158https://s7.addthis.com/js/300/addthis_widget.js:2:361724 在 o (https://s7.addthis.com/js/300/addthis_widget.js:2:223353) 在 https://s7.addthis.com/js/300/addthis_widget.js:2:215504 在 HTMLDocument.onReady (https://s7.addthis.com/js/300/addthis_widget.js:2:214257)

第 2 行 addthis_widget.js

最终编辑和解决方案:我学会解决这个问题的最好方法是通过 USB 连接我的 Nexus 6p,启用 USB 调试,然后 https://developers.google.com/web/tools/chrome-devtools/remote-debugging/

首先,Ionic view 并不支持所有的第三方插件,因此您必须先构建它并在真实设备中进行测试。但我不确定这是否有效。因为在网站而不是应用程序上添加此共享,并且在您开发应用程序时,所以您必须像应用程序开发人员而不是 Web 开发人员一样思考。当您从网站分享内容时,它会 post 进入社交应用程序的网站。但是,当您从应用程序分享内容时,它会 post 进入社交应用程序。

所以根据我的建议,如果 Add This 仍然可以在您的真实设备上运行,尽管您不应该使用它,因为您使用的是 Ionic,所以您必须在应用程序上共享。

我解决了您关于为什么您的脚本未加载的原始问题:它涉及您对 // 的使用以及在 httphttps 之间切换。如果你的 Ionic URL 使用 https://,你的脚本 src 中的 // 也会尝试使用 https 检索你的脚本,它可能不会加载。

由于您已编辑,我已指出 file:// 仅适用于您的本地文件系统。如果您尝试从服务器引用它,它仍会尝试从客户端机器加载资源。

如果您需要进一步的帮助,我建议您再发一个问题。