javascript - Why Addthis share button is not working without server? - Stack Overflow

Here is my Code of Addthis:<script type="textjavascript" src="addthis_widget.js"

Here is my Code of Addthis:

 <script type="text/javascript" src="addthis_widget.js"></script>
 <script type="text/javascript">
      var addthis_config = {
           services_expanded: 'facebook, twitter'
 }
 </script>

 <a addthis:services_pact="facebook,twitter" addthis:services_expanded="facebook,twitter" addthis:url="#" class="addthis_button" href="#"><img id="btn_share" name="btn_share" style="cursor:pointer;" src="path to image" alt="Share" /></a>

If I put this Addthis code in simple HTML file and try to run through any server for example in my case I'm using Apache. And try to run from the browser through localhost/myaddthis.html, than its work fine (show the proper popup to share specific link to facebook and twitter).

But the problem is: when I try to run simple html file direct inside browser, then its just show the image, don't show the proper addthis share popup.

It's just a simple .HTML file (there is no server side code inside the file), than why its not running without server.

I want to use this code without server. How I do that?

Here is my Code of Addthis:

 <script type="text/javascript" src="addthis_widget.js"></script>
 <script type="text/javascript">
      var addthis_config = {
           services_expanded: 'facebook, twitter'
 }
 </script>

 <a addthis:services_pact="facebook,twitter" addthis:services_expanded="facebook,twitter" addthis:url="#" class="addthis_button" href="#"><img id="btn_share" name="btn_share" style="cursor:pointer;" src="path to image" alt="Share" /></a>

If I put this Addthis code in simple HTML file and try to run through any server for example in my case I'm using Apache. And try to run from the browser through localhost/myaddthis.html, than its work fine (show the proper popup to share specific link to facebook and twitter).

But the problem is: when I try to run simple html file direct inside browser, then its just show the image, don't show the proper addthis share popup.

It's just a simple .HTML file (there is no server side code inside the file), than why its not running without server.

I want to use this code without server. How I do that?

Share Improve this question asked Oct 1, 2012 at 16:13 Dawood ButtDawood Butt 4966 silver badges22 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

You're probably viewing your pages by opening them as local files rather than loading them from a web server. So instead of the URL of the page in your browser starting with http:// it starts with C:\ or file://

Here's what the AddThis buttons look like when viewed via http:// - https://i.sstatic/hdiiV.png

And here's the same file viewed using file:// - https://i.sstatic/m7re9.png

We currently are using protocol-free URLs in our code - ones that start with // instead of http:// or https:// - to make sure our SSL implementations are cross patible without extra work. However, if you're loading the test page with the file:// protocol it causes the CSS and other JavaScript files not to load, since it's looking for them on your local machine rather than our web servers.

I've submitted a ticket to our developers to fix this for people previewing pages using their file system rather than a web server, but until they can get that implemented you should either understand that the buttons won't show up if using the file:// protocol or use a web server in order to test how your sites display in browsers.

I believe it's normal since AddThis is to share stuff on social websites. If you're not on a server, you won't be able to share stuff because it's a local file.

It's probably inside the addThis code to check for the server. If it's not a server then it doesn't have to share.

This is mon sense if you ask me but I could be wrong.

Addthis will check for the current url - http://localhost/etc. is a valid location, but file://path/to/yourfile.html is not.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744308415a4567830.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信