There is a lot of websites that use Ctrl+Enter for sending web forms. But in Opera, since 11.50 build 1018 , this hotkey sends a form into a new background tab.
And Opera Next (12.50) even opens several new background tabs!
The sample code looks like this:
<form method="post" id="form">
<textarea id="text"></textarea><br /><br />
<input type="submit" value="submit" id="submit" />
</form>
<script type="text/javascript">
$(document).ready(function(){
$('#text').keypress(function(event){
if (event.ctrlKey && (event.which == 10 || event.which == 13)) {
event.preventDefault();
event.stopPropagation();
event.ctrlKey = false;
$('#submit').click();
}
});
$("#submit").click(function(event){
event.ctrlKey = false;
});
});
</script>
Link to check out http://jsfiddle.net/8pYsv/
How can I avoid this behaviour? As Opera user, not as a website admin.
There's no config option in Opera for Ctrl Click , and event.ctrlKey = false;
not working.
Only replacing $("#submit").click()
with $("#form").submit()
helps.
But there are many websites that will not change their code just for Opera..
Thanks in advance for any help!
You can change you key-combination in Opera's settings:
Ctrl-F12
-> Shortcuts
-> Keyboard Setup
-> Edit
-> Type 'background'
-> Edit or delete the desired key combination.
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.