The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 19, 2019, 02:52:33 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: How to stop youtube video going to youtube when clicked?  (Read 4724 times)
patch
Rookie
**
Offline Offline

Posts: 32


View Profile
« on: January 14, 2010, 01:13:23 AM »

Hi,

Not sure if this should be here or in the javascript forum ... but here goes...

I wonder if there is a way to do this:

I've got a wordpress blog with embedded youtube videos. When a visitor clicks the video it starts to play - so far so good.

If the visitor clicks on the video again, a new window opens and the visitor gets taken to the video page on youtube.

So, question is, is there a way to either stop the new window opening and the visitor begin taken away from my site or even to interrupt that process and redirect to another site of my choice or simply cancel that request?

Cheers,
Mark
Logged
kurdt
Lifer
*****
Offline Offline

Posts: 1153


paha arkkitehti


View Profile
« Reply #1 on: January 14, 2010, 01:35:57 AM »

I haven't done this myself but you could try to wrap youtube code around div and then make a script that allows 1 click but after executes void(0); or something when trying to click in that div. Now I have no idea if this actually works and I can think of few things that might prevent it from working but it was the first thing that came to mind Wink

*edit* Yeah and with that suggestion you effectively disable user from using player controls Cheesy But if you want to go hifi, you could just do "allowed click field" based on pixel coordinates and that way make the bottom 20px clickable and the rest you can click only once.
Logged

I met god and he had nothing to say to me.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #2 on: January 14, 2010, 11:46:42 AM »

The code that comes down with the embedded controls that, you're not really going to be able to get in the way.

That said, if the video was z-indexed behind a transparent gif that covered the whole thing, and you trapped for clicks on that graphic (so that the event wouldn't bubble back up to the youtube vid) I believe you could effectively kill it. Never tried to z-index a TY vid behind something, but I don't see any reason why it can't be done (unless their code specifically tries to z-index it way way way out front...)
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
patch
Rookie
**
Offline Offline

Posts: 32


View Profile
« Reply #3 on: January 15, 2010, 08:29:32 AM »

Thanks guys,

I'll try to mess about with the z-index transparent gif way ...
Logged
KaptainKrayola
Keeper of Pie
Global Moderator
Lifer
*****
Offline Offline

Posts: 994



View Profile WWW
« Reply #4 on: January 15, 2010, 01:13:08 PM »

i don't know if this is still the case but it used to be that flash vids were z-indexed above everything (Except iframes) and there wasn't anything you could do about it.  May not be the case anymore but i remember running into that problem with dhtml menus back in the day.

Logged

We can't stop here, this is bat country.
mystyle
n00b
*
Offline Offline

Posts: 7

Lets Be`Connected!!


View Profile WWW
« Reply #5 on: January 26, 2010, 10:32:02 PM »

I saw this technique is still in use. I saw a site on the internet where you tube video is embedded  when user clicks on the video they are not redirected to the you tube sight but the video stops.This is the sight where you can see and download videos without redirecting to you tube the original site.Have a look on this site you could find the answer. www dot therockmission dot com/

Ah, and now we get to it Wink URL munged.
« Last Edit: January 27, 2010, 09:40:22 PM by perkiset » Logged

No links in signatures please
Phaėton
Lifer
*****
Offline Offline

Posts: 555


⎝⏠⏝⏠⎠


View Profile
« Reply #6 on: April 26, 2010, 03:02:52 PM »

i dont know javascript but perhpas you could hook the onstatechange event with
the youtube data api:

http://code.google.com/apis/youtube/js_api_reference.html#Adding_event_listener

oh if only i had time to play with this...
Logged

When I was your age we used to walk to the TV to change the channel....  _̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!