Ky sajt do të funksionojë me kufizime, teksa bëjmë mirëmbajtjen e tij për të përmirësuar punën tuaj. Nëse një artikull nuk e zgjidh problemin tuaj dhe dëshironi të bëni një pyetje, kemi bashkësinë tonë të asistencës, e gatshme për t’ju ndihmuar, te @FirefoxSupport në Twitter dhe/r/firefox në Reddit.

Kërkoni te Asistenca

Shmangni karremëzime gjoja asistence. S’do t’ju kërkojmë kurrë të bëni një thirrje apo të dërgoni tekst te një numër telefoni, apo të na jepni të dhëna personale. Ju lutemi, raportoni veprimtari të dyshimtë duke përdorur mundësinë “Raportoni Abuzim”.

Mësoni Më Tepër

problem with manual click versus javascript: simulated click

  • 2 përgjigje
  • 1 e ka hasur këtë problem
  • 1 parje
  • Përgjigjja më e re nga toes314

more options

Hi!

I have been trying to simulate from javascript, a click on a link. Sounds simple, yes?

I have FF configured to open new pages in new tabs, by default. So I'd like the simulated click to open the page pointed to by the link, in a new tab. The way I'm simulating the click does attempt to open the page, but the built-in pop-up blocker treats that as a pop-up. That was a surprise to me!

I've created a couple trivial HTML pages to illustrate the problem.

Although I normally have quite a few "extensions" loaded into FF, I am using a separate very simple FF profile to try to make sure the extensions aren't causing the problem.

The first HTML page I'm using to test is literally this:

<meta charset="US-ASCII"> Click Me! <script type="text/javascript"> document.anchors[0].click() ; </script>


The page in the href is literally just this:

<meta charset="US-ASCII"> GOT IT!

I've also tried an alternative approach with initMouseEvent() and dispatchEvent() with an event sequence like, mouseover, mousedown, mouseup, click, but then nothing at all happens.

I would hope there should be a way to do this in FF that doesn't cause FF to treat the result as a pop-up, even then trying to open a page in another tab. But even if I wanted to configure the pop-up, it doesn't appear possible. I'm doing very simple testing with local pages, using the file: scheme. The file: scheme doesn't appear to be supported by the pop-up blocker.

Any explanation of how to do this in FF would be greatly appreciated!

Hi! I have been trying to simulate from javascript, a click on a link. Sounds simple, yes? I have FF configured to open new pages in new tabs, by default. So I'd like the simulated click to open the page pointed to by the link, in a new tab. The way I'm simulating the click does attempt to open the page, but the built-in pop-up blocker treats that as a pop-up. That was a surprise to me! I've created a couple trivial HTML pages to illustrate the problem. Although I normally have quite a few "extensions" loaded into FF, I am using a separate very simple FF profile to try to make sure the extensions aren't causing the problem. The first HTML page I'm using to test is literally this: <!DOCTYPE html> <html> <head> <meta charset="US-ASCII"> </head> <body> <a id="click_anchor" name="click_anchor" href="file:///home/toes/src/js/got_it.html" target="_blank"> Click Me! </a> <script type="text/javascript"> document.anchors[0].click() ; </script> </body> </html> The page in the href is literally just this: <!DOCTYPE html> <html> <head> <meta charset="US-ASCII"> </head> <body> GOT IT! </body> </html> I've also tried an alternative approach with initMouseEvent() and dispatchEvent() with an event sequence like, mouseover, mousedown, mouseup, click, but then nothing at all happens. I would hope there should be a way to do this in FF that doesn't cause FF to treat the result as a pop-up, even then trying to open a page in another tab. But even if I wanted to configure the pop-up, it doesn't appear possible. I'm doing very simple testing with local pages, using the file: scheme. The file: scheme doesn't appear to be supported by the pop-up blocker. Any explanation of how to do this in FF would be greatly appreciated!

Krejt Përgjigjet (2)

more options

See this pref for the behavior with JavaScript window.open() calls.

A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.

The helpers at that forum are more knowledgeable about web development issues.
You need to register at the MozillaZine forum site in order to post at that forum.

more options

Thanks for the info!