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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
alexwerner's avatar
51
alexwerner
updated 13 years ago, asked 13 years ago

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 (13 years ago)

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 (13 years ago)

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 (13 years ago)

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 (13 years ago)
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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 13 years ago
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 (13 years ago)

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 (13 years ago)
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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
alexwerner's avatar
51
alexwerner
answered 13 years ago
link

Comments

see more comments