Javascript disable double click on canvas - javascript

I have an issue about embedded canvas is that I don't want
to use double click feature on it.
While API given by Sketchfab doesn't offer such functionality, is there a way to block event getting there in the first place ?
UPDATE:
I am embedding model from Sketchfab.
Here's the embed:
<div class="sketchfab-embed-wrapper"><iframe width="640" height="480" src="https://sketchfab.com/models/9eb60eebc20e45c4b586e1a6fe6c5983/embed" frameborder="0" allowvr allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""></iframe>
...

Since you stated that you are using Sketchfab (which is embedded with an iframe) this is not possible due to XSS protection. No major browser will allow you to access embedded cross site content.
Take a look at this link for more information about cross-frame scripting and security.

can you check this? Remove Event
$('canvas').off('dblclick');
https://jsfiddle.net/gtbypwLb/

Related

Is there a way to manipulate an embedded video using JS without APIs?

I have the following Iframe attached to my HTML code:
<iframe width="640" height="360" src="" frameborder="0" scrolling="no" allowfullscreen></iframe>
where the src can be any embedded video (like https://www.youtube.com/embed/fWa5kDtyV0w, for example). What I'm trying to do is the following: when the user pause the video, a function must be called to save the time of the video in a variable. However, I cannot find a way to this if, unless of using specifics APIs, like the one from Vimeo or Youtube (what I don't want to do, because some platforms don't have it). So, is there a way to interact with the video in the Iframe using JS or other stuff?
Extra information: In some of my tests, I got blocked by the browser by XSS.

Stopping JavaScript manipulation to YouTube embed code

I am trying to add a YouTube embed link on to a web page I did not originally develop (and therefore not that familiar with it) with lots of different things already going on with it (i.e. many other js calls, etc) - so in other words for a novice JavaScript debugger like me it is pretty tricky to identify things.
For some reason, the page changes any YouTube embed link to a near full screen width video. I want it to simply run as per the code I am pasting in, which for this example is:
<iframe src="//www.youtube.com/embed/tGvHNNOLnCk?rel=0" height="315" width="560" allowfullscreen="" frameborder="0"></iframe>
I can see the code it swaps it out with is:
<div class="fluid-width-video-wrapper" style="padding-top: 56.25%;"><iframe src="//www.youtube.com/embed/tGvHNNOLnCk?rel=0" allowfullscreen="" frameborder="0" id="fitvid802730"></iframe></div>
When I turn JavaScript off, the embedded video displays at the right size, and uses the original code - so it's clear to me it has something to do with JavaScript.
Bearing in mind I am new to JavaScript debugging, What is the easiest way to somehow cleanly disrupt any operations on this kind of code so there are no manipulations done to the youtube embed code?
I am using Google Chrome dev tools.

End events for embedded videos

I'm trying to find a way to listen for the end/complete event of a video embedded from youtube/metacafe/vimeo etc. I know this can be accomplished by things like the youtube API using onStateChange with a value of 0, but I'm curious if it can be done without having to go through the API.
For example if I have something like:
<div id="video-container">
<iframe width="420" height="315" src="http://www.youtube.com/embed/0Bmhjf0rKe8" frameborder="0" allowfullscreen></iframe>
</div>
is there anyway I can listen for the end event on the div or iframe?
kind of like this:
Javascript player for managing playlist of vimeo *and* youtube videos?
But I'm interested in adding several sources so it would be much easier if I didn't have to go through the APIs.
Thanks-
I think, it's not possible for youtube. It would be possible if you used your own flash player. You would be able to call custom javaScript function from yuor flash player.

embedding a web page in iFrame problem

I embedded a web page in an iFrame like this:
<iframe id="frame" src="http://www.domain.com" width="100%" frameborder="0" marginheight="0" marginwidth="0"></iframe>
Edit: The problem i am having is that the web page javascript is using the top property to find objects but now it is embedded in the iframe, is there a way to over ride this?
If I understand you right, you want to send data from the iFrame to the parent? If so, the error happens because Cross Site Communication is usually blocked to avoid XSS attacks. But you can keep your iframe, and use JavaScript and the window.postMessage(); function to share data.
https://developer.mozilla.org/en/DOM/window.postMessage

Can I track an IFRAME widget with Google Analytics?

We are going to launch JS based widgets which webmasters (any site) will be putting on their site by embedding a small code snippet like :
<iframe src="SOURCE_PATH" frameborder="0" width="300px" height="150px" scrolling="no" id="cd_frame"></iframe>
Inside the widget there are three links and we need to track how many clicks are happening on them from the external sites where the widget is going to get used.
If I simply put the code which GA provides will that work? OR do I need to make any changes?
Thanks.
you should be able to track from your iframe as it would appear to google analytics as a regular page. your issue would be knowing what iframe you were tracking. if you can pass a unique id via the iframe url then you should be able to add a custom parameter to track the different sites.
eg
<iframe src="SOURCE_PATH?uniquetrackingid=123" frameborder="0" width="300px"
height="150px" scrolling="no" id="cd_frame"></iframe>
information about custom tracking codes can be found here
http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55585

Categories

Resources