0plus1
0plus1

Reputation: 4555

Custom link on embedded youtube video

I'm looking to direct the user on the channell webpage instead of the video url that I'm embedding. I've read the api and I didn't see any way to achieve this. I tried enclosing the embedded video in a and I added this code:

$('#youtube').click(function() {
    document.write('http://www.youtube.com/user/0plus1');
    return false;
});

And surprise it won't work.

How, if it's even possible I can do this?

Upvotes: 0

Views: 260

Answers (1)

dsimard
dsimard

Reputation: 7428

The document.write will do nothing. If you want to redirect, you should write

$('#youtube').click(function() {
  window.location.href = 'http://www.youtube.com/user/trasportareoggi';
  // or you could use window.replace('http://www.youtube.com/user/trasportareoggi');
  return false;
});

Upvotes: 2

Related Questions