We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Dette websted vil have begrænset funktionalitet, mens vi gennemgår vedligeholdelse for at forbedre din oplevelse. Hvis en artikel ikke løser dit problem, og du vil stille et spørgsmål, har vi vores supportfællesskab, der venter på at hjælpe dig på @FirefoxSupport på Twitter og/r/firefox på Reddit.

Søg i Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Læs mere

Firefox redirecting on ondragend event on youtube.

  • 1 svar
  • 1 har dette problem
  • 6 visninger
  • Seneste svar af Shadow110

more options

I'm trying to make an addon to firefox, that is supposed to let you create a custom, temporary playlist on youtube, by dragging and dropping the video you want to add to this temporary playlist, but whenever I try to drag and drop a video on the box that I created (to test if my code works so far), firefox automatically plays this video (unless I have an alert), so I wonder if it's possible to cancels firefox redirect in some other way than an alert, since it's pretty "unsmooth".


The code I'm using is

_____________________ //Formatting and creating the test box you drag the video to var test = document.createElement("test"); document.getElementsByTagName("ytd-app")[0].appendChild(test); //the design of the box test.style.color = "black"; test.style.backgroundColor = "white"; test.style.border = "1px solid lightgrey"; test.style.position = "fixed"; test.style.top = "56px"; test.style.right = "0px"; test.style.width = "125px"; test.style.height = "700px"; test.style.zIndex = "10";

//the events that are supposed to get which video is being dragged var box; test.ondragstart = function DragStart(ev) {

   box = ev.target;

} test.ondragover = function DragOver(ev) {

   ev.preventDefault();

} test.ondrop = function Drop(ev) {

   test.style.backgroundColor = "blue";
   document.write("Hello World");

} test.ondragover = "allowDrop(event)"; __________________


What happends is that whenever I run this on youtube, and drag a video into the box, mozilla firefox redirects to the video, which is what I want to prevent

edit: Code and clearification (don't know how to create a code "block"

I'm trying to make an addon to firefox, that is supposed to let you create a custom, temporary playlist on youtube, by dragging and dropping the video you want to add to this temporary playlist, but whenever I try to drag and drop a video on the box that I created (to test if my code works so far), firefox automatically plays this video (unless I have an alert), so I wonder if it's possible to cancels firefox redirect in some other way than an alert, since it's pretty "unsmooth". The code I'm using is _____________________ //Formatting and creating the test box you drag the video to var test = document.createElement("test"); document.getElementsByTagName("ytd-app")[0].appendChild(test); //the design of the box test.style.color = "black"; test.style.backgroundColor = "white"; test.style.border = "1px solid lightgrey"; test.style.position = "fixed"; test.style.top = "56px"; test.style.right = "0px"; test.style.width = "125px"; test.style.height = "700px"; test.style.zIndex = "10"; //the events that are supposed to get which video is being dragged var box; test.ondragstart = function DragStart(ev) { box = ev.target; } test.ondragover = function DragOver(ev) { ev.preventDefault(); } test.ondrop = function Drop(ev) { test.style.backgroundColor = "blue"; document.write("Hello World"); } test.ondragover = "allowDrop(event)"; __________________ What happends is that whenever I run this on youtube, and drag a video into the box, mozilla firefox redirects to the video, which is what I want to prevent edit: Code and clearification (don't know how to create a code "block"

Ændret af Leagon den

Alle svar (1)

more options

Hi, if you were expecting developers and engineers, you get Volunteers.

So no idea what you are doing. You can ask for help in stackoverflow.com You usually start here :

follow the links.

Thank you for explaining in better in detail it maybe something someone knows here, Thanks for providing the code, may take awhile. Also it maybe out dated as code changed in 57 and in 60.

Ændret af Shadow110 den