so I was able to trigger a click event on a span from another window using:
var openerBody = $(window.opener.document.body);
$('.thespan', openerBody).click();
but then when I change that span object to an <a>
tag, the click trigger stops working...
Is there a way to trigger a click event from another window on an <a>
tag?
Some browsers won't allow you to call click
on an a
tag, to prevent you form over-manipulating the user's browser. But you can use the href
attribute to redirect the user.
window.location.href = $('.thespan', openerBody).attr('href');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.