problem with manual click versus javascript: simulated click
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!
Toutes les réponses (2)
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.
Thanks for the info!