Consider this simple link:
<a href="#" onclick="javascript:{return false;}">Do Nothing</a>
When this is in the main document in a window, clicking it does nothing, because the return false
cancels the click.
But when this is in an iframe
document (in Firefox and Chrome at least), it opens a new tab window.
This is very annoying because I want to be able to hook a click event (in actuality using jQuery's $(element).click(handler))
), do some logic, cancel the navigation, and NOT have that extra tab.
What's going on here and how can I stop this behavior?
It turned out that I had an unrelated jQuery click
event that was causing this behavior, so this was my user error. Dumb.
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.