AddThis and History.js - automatic redirection to wrong URL - redirect

I have a problem with AddThis widget and History.js script.
Once user shares some page on Facebook using AddThis widget, some hashtag is appended to URL (e.g. #.U-S_Q-q0tE8.facebook).
Then, if user clicks such link on Facebook and goes to my website with URL e.g.: http://domain.com/path/to/content,123.html#.U-S_Q-q0tE8.facebook, they get redirected to http://domain.com/path/to/.U-S_Q-q0tE8.facebook which throws error 404.
The weird thing is that History.js is not even initialized or used. It's just embed on the site with <script...> tag.
Is there any solution to this? Is it possible to disable such behavior in History.js?

I have the exact same problem, and while I don't know if you can disable the history.js behavior, you can disable the addthis hashes by adding the following before the addthis script
<script type="text/javascript">
var addthis_config = {
data_track_clickback: false
}
</script>
This means you wont be able to track how many click that link gets using addthis, but something like Google Analytics is able to show traffic source.
Source

Related

Inserting facebook share button on personal website

I want to put a button on my website that will open a popup for the user to share the url on its profile.
I followed the steps shown here, after click on 'get code':
1. Include the Javascript SDK on your page once, ideally right after the opening <body> tag.
2. Place the code for your plugin wherever you want the plugin to appear on your page.
but I get a blank div without the button. What's missing? Do I need to register on facebook developers? Do I need to include some javascript src in the <head>?
On twitter is very simple, you just need to get the code from here
Edit: I want something like youtube facebook share.
As noted in the comments, somehow the default method as suggested by Facebook is not working, or rather the way the share button documentation suggests is not clear enough. This answer as suggested appears to work. Note that you will need a Facebook App ID.
Alternatively, this answer allows for a simple link, which you then have to style yourself with CSS, this alternative has the benefit of making share buttons that are consistent in design with your website, if you just want the vanilla blue Facebook button then continue with this answer.
Squarespace also details the default way of adding a facebook like button, my attempts to get it to work in a jsFiddle were not successful.
Get an AppID and embed the Facebook script in your website.
This step is explained in detail in the official documentation, where you just generate your own AppID then copy paste the script code (usually after the <body> tag.
Add a jQuery library for the next bit of code as explained in this answer.
The share dialog box script:
-
<script type="text/javascript">
$(document).ready(function(){
$('#share_button').click(function(e){
e.preventDefault();
FB.ui(
{
method: 'feed',
name: 'This is the content of the "name" field.',
link: 'Your-blog-link',
picture: ‘http://yourpicture-here’,
caption: 'yourCaption',
description: short-description-here
message: ''
});
});
});
</script>
More parameters can also be added to customize the button.
Lastly, add the image/element you want to be the share-button:
Something like: <img src = "share_button.png" id = "share_button">

Website Redirection Fix?

I run an anime website with embeded links for players, multiple per page/per episode so I have quite a few, and on some of the pages, the players are redirecting the user to adultfriendfinder, which is very annoying because it doesn't redirect them through a popup or a new tab, it redirects my site to their page, and this happens even with adblock.
here is a link to my website, and a page that will display this:
http://animewolf.tv/anime/death-note-episode-1-dubbed/
if you click on 'mp4upload' it will redirect to adultfriendfinder.com, you'll need to press back and play the video, which is very annoying.
If it doesn't redirect you and you want to see, just look around the site's episodes ( http://animewolf.tv/watch-anime/ )
Is there anything I can do to get around this? any plugin, anything I can do to block the site? anything?
thx.
if you see from the firebug, i find network error (404) in http://www.myanimelinks.com/nanotabs.js which redirect you to google-ads(adsense). It is known that if no proper ads exists based on your site will force google to redirect the ads to other ads or blank (and google dislike ads inside a frame.
Besides, links to access http://www.myanimelinks.com/nanotabs.js is denied, blocked or redirect to 404 page.
if you access this following link> without frame, everything is going well:
http://animewolf.tv/wp-content/plugins/anime/embed/auengine.php?id=e5XVDRmg
In this case, you should remove other links available which causes error.
UPDATE:1
this links > http://animewolf.tv/wp-content/plugins/anime/video_source.php?source=YToxOntpOjA7YTozOntzOjI6ImlkIjtzOjEyOiI2aGMzY2w1b3NjZzkiO3M6NDoidHlwZSI7czoxOiI5IjtzOjY6Im51bWJlciI7czoxOiI3Ijt9fQ== go to encrypted page content then you add it to your page within frame. this causes this.
now try to add this link > http://animewolf.tv/wp-content/plugins/anime/embed/auengine.php?id=e5XVDRmg directly to the src="" of your frame. perhaps, it can work.
UPDATE:2
Try this and place on your page which globally relate to them:
<script>
$(document.body).ready(function(){
$(document).on('click', 'a', function(e){
e.preventDefault();
e.stopImmediatePropagation();
return false;
});
});
</script>
otherwise, see this:
http://stackoverflow.com/questions/15811079/stop-redirecting-in-javascript

How to get the url from a input field?

I recently develop a shortener URL script, now I'm trying to add Addthis buttons but the problem is that is sharing the current URL of the site is on. I want the Addthis buttons share the URL that is inside of the URL Input field anybody got some idea on how to do it?
Basically I want to add Addthis buttons and share the URL from a Input field that got the URL shorted .
The Real Question: How can you specify a custom URL for Addthis?
jQuery Solution
HTML
<a href="http://www.addthis.com/bookmark.php" class="addthis_button" id="youmusthaveanid">
jQuery
$('#youridhere').attr('addthis:url', $('#yourinput').val);
Note: Remember you will have to trigger this on every update of the text box if it's content changes after the Javascript has been run on initial load.
PHP Solution
HTML/PHP
<a href="http://www.addthis.com/bookmark.php" class="addthis_button" addthis:url="<?=$yourvariablehere?>"
Source: Addthis API Docs

og meta tags, social buttons and angularjs

I'm creating a website using multiple views.
The tag and the tags of the page get changed through a a $rootScope variable.
so I have something like
<html>
<head>
<title ng-bind="page_title"></title>
<meta property="og:title" content="{{page_title}}">
</head>
Whenever each view get loaded on the website, the page_title variable changes and the title and the og:title tags get updated (everything works as expected).
The problem is that I need, on some views to load a facebook, a google+ and a twitter button.
I can display them properly but if I click on each them the page title appear to be something like:
{{page_title}}
I've tried to delay the execution of the scripts of each button using setTimeOut but to no good.
But the scripts just read whatever is written, they don't parse the page_title.
Does anyone know a workaround to this?
Thank you
This can't be done using javascript. Some people think that Facebook is reading what's currently on the page. It's not. It makes a separate request to your server using the same url (from window.location.href) using it's Scraper, and the Facebook Scraper does not run javascript. That's why you get {{page_title}} when clicking on something like a Facebook share button. Your content will have to be generated by the server so when Facebook goes to hit the url it gets the content it needs up front without the need for javascript. You can tackle the server side rendering in a fews ways.
You can allow your server side technology to render the content.
You can use the PhantomJS approach https://github.com/steeve/angular-seo.
There's also a possibility that you can re-render Facebook widgets. Use their parse method:
FB.XFBML.parse();
after your angular stuff has completed. It's not working for my share button (yet!!), but I tested it on likes, and it's cool. Basically it re-scans the DOM and renders the Facebook widgets. You can also pass it a single element, something like this directive:
'use strict';
angular.module('ngApp')
.directive("fbLike", function($rootScope) {
return function (scope, iElement, iAttrs) {
if (FB && scope.$last) {
FB.XFBML.parse(iElement[0]);
}
};
});
This snippet would rescan the DOM for html5 facebook fb-like widgets when creating the last element in angular repeater.

Facebook | redirect error

I have facebook connect button on a page of my site and I want user to redirect to a page after a successful login: here's the code snippet:
</script>
<fb:login-button onlogin="facebook_onlogin();">
</fb:login-button> <script type="text/javascript">
FB.init("API_KEY", "http://myip/facebookapp/xd_reciver.html/");
function facebook_onlogin() {
window.location="http://myip/facebookapp/mypage/"
}
</script>
But when I logged in it redirects to the page INSIDE the pop-up, how can I redirect to the page out side of the popup..
In my experience, this is generally caused by not having the cross-domain receiver file set up properly.
Assuming you copied the cross-domain receiver file that Facebook provides, then in your code snippet above, it looks like you misspelled "receiver" in xd_receiver.html. Double-check that it is a valid URL by copying and pasting it into your browser and making sure it can be loaded... my guess is you'll have to fix the spelling and remove the trailing slash, ie. http://myip/facebookapp/xd_receiver.html. Double-check the API key while you're at it, Facebook Connect can be quite frustrating to set up sometimes.
Are you using latest connect javascript sdk by facebook or the oldest one ?
checkout the latest javascript sdk by facebook http://developers.facebook.com/docs/reference/javascript/
Here you'll see nice working example.