First time here? Check out the FAQ!
2

Social sharing buttons javascript bug

Steps to reproduce:

  • Disallow PopUps in your browser
  • Click on any of the social sharing buttons next to a question, except google+

Expected result:

  • The sharing page opens in the current window/tab

Actual result:

  • No page opens
  • Javascript error log:

ReferenceError: Can't find variable: share_url in post.js:1573

Versions affected:

  • 0.7.22 - 0.7.29
  • Skins old and default
alexwerner's avatar
51
alexwerner
updated 2011-11-16 16:05:58 -0500, asked 2011-11-15 05:20:57 -0500
edit flag offensive 0 remove flag close merge delete

Comments

I did not see the error in the console, but obviously if you block the pop-ups - they won't open. Current implementation uses pop-up windows - so it is perhaps a misfeature. A js-popup would be nicer, we'll look into that.

Evgeny's avatar Evgeny (2011-11-15 08:00:28 -0500) edit

Just looked at post.js myself: If you change the name of share_url to url, the sharing page opens in the current window if the popup cannot be opened.

alexwerner's avatar alexwerner (2011-11-15 08:11:17 -0500) edit

Hmm, did not think of that, I am not sure I like that a whole page from another site will take entire screen. I really prefer a js popup.

Evgeny's avatar Evgeny (2011-11-15 08:24:13 -0500) edit

Yes, a popup is indeed preferable... perhaps informing the user that the popup could not be opened, as clicking on the sharing buttons and nothing happens is bad behavior, I think.

alexwerner's avatar alexwerner (2011-11-15 08:27:35 -0500) edit
add a comment see more comments

2 Answers

0

Tried a quick iframe in a js pop-up implementation - does not work for facebook.

Turns out there is an HTTP header that you can use to forbid displaying your site in iframes - which apparently facebook does - so apparently the only options are: pop up window and replace the view in the current window.

Would be nice to be able to detect when pop-ups are blocked and then go for the second option as a fallback.

Evgeny's avatar
13.2k
Evgeny
answered 2011-11-15 08:52:46 -0500
edit flag offensive 0 remove flag delete link

Comments

After looking at post.js a bit more it seems as the fallback is already implemented, but buggy: If the pop up window fails, it is tried to open the link in the current window, but the wrong variable is used.

alexwerner's avatar alexwerner (2011-11-15 09:05:50 -0500) edit

After looking at post.js a bit more it seems as the fallback is already implemented, but buggy: If the pop up window fails, it is tried to open the link in the current window, but the wrong variable is used.

alexwerner's avatar alexwerner (2011-11-15 09:05:51 -0500) edit
add a comment see more comments
0

Detection of blocked pop-ups and fallback to open the link in the current window is now fixed in https://github.com/ASKBOT/askbot-devel/commit/d39849bc2e73d1c9cdcb07b12fe6fdf6d562e582">git.

alexwerner's avatar
51
alexwerner
answered 2011-11-16 16:04:54 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments