Ian Young
Ian Young

Reputation: 21

Universal reddit share button

So I want to make a bookmark that lets me share any page I'm on and has that page's URL already inputted.

For example this

https://www.reddit.com/submit?url=http%3A%2F%2Farstechnica.com%2Fscience%2F2015%2F04%2Fsupernova-differences-could-change-our-understanding-of-dark-energy%2F&title=Supernova+differences+could+change+our+understanding+of+dark+energy

will send you to Reddit with the URL (and title, but I'm not concerned with that) already input.

I have used location.href in this bookmark

javascript:location.href+="&feature=mfu_in_order&list=UL"

while on a YouTube video to add &feature=mfu_in_order&list=UL to the end of the URL of the page I'm on.

I tried to add location.href to https://www.reddit.com/submit?url=, but I get a blank submit page.

I know next to nothing about JavaScript, so forgive me if this in not possible. I think this might be failing because of same origin?

If that route doesn't work, I also have a universal facebook share bookmark

javascript:var d=document,f='http://www.facebook.com/share',l=d.location,e=encodeURIComponent,p='.php?src=bm&v=4&i=1238893127&u='+e(l.href)+'&t='+e(d.title);1;try{if (!/^(.*\.)?facebook\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z) {a=function() {if (!window.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=1,width=626,height=436'))l.href=f+p};if (/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}}void(0)

I tried to replace http://www.facebook.com/share with https://www.reddit.com/submit?url= but that gets me this http://r.php?src=bm as the URL submitted. Any advice is appreciated.

Upvotes: 2

Views: 3833

Answers (1)

Xiong Chiamiov
Xiong Chiamiov

Reputation: 13714

This works for me:

javascript: location.href = 'https://www.reddit.com/submit?url=' + location.href

Upvotes: 4

Related Questions