Share button without an href


#1

Hi,

We are trying to add the Share button to our site but cannot use <a href

I tried to change it to e.g. <span id

But this did not work - are there any alternatives that will work?

Greg


#2

You can use the iframe notation described here: https://dev.twitter.com/docs/tweet-button

I’m curious- why can’t you use an anchor with a href? It’s a very common HTML element.


#3

We would just prefer it to not use that method based on internal reasons.

I read somewhere in a blog comment the a href part is not needed, is there a way to do it without the iframe method and not an href?


#4

You can try leaving the href attribute out of the anchor element, but I’m not sure whether the button Javascript will identify the link correctly, and you’re removing the fallback for users without Javascript enabled.


#5

Ok - is there any other way than to use an empty then - like some kind of span or div etc


#6

A quick test verified that leaving the href out works:

Tweet

Or is the anchor element completely out of the question? I really don’t understand why your platform would not allow iframes or anchors, but allows script includes. If you can give me some background on why you’re being limited, maybe I can help come up with an alternative.


#7

I want share button without an href.


#8

I’m a mobile developer. We do not use <a> tags. We use a completely javascript based logic for links. This is not that unusual. iFrames are simply out of the question. How do I build a twitter button without an <a> tag? Must I rewrite your javascript? Is there an API? Thanks.


#9

I just wrote my own script, it is probably easier.


#10

There’s a way to add the official buttons using Javascript:
https://dev.twitter.com/docs/intents/events


#11

Its possible with Span id in twitter framework. .!


#12