Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript for new tab (CTRL+T), new window (CTRL+N)?

When flash has keyboard focus, CTRL+T (new tab) and CTRL+N (new window) are intercepted by flash.

Is there a way to pass these events through to the browser so that they work (opening new tab, opening new browser) OR is there a javascript command for these actions?

like image 690
jedierikb Avatar asked Feb 26 '09 23:02

jedierikb


2 Answers

This is a long standing issue with Flash and browsers. (And I mean long - check out this eight-year-old bug on Mozilla browsers.) The problem is that Flash intercepts all input events, rather than the browser. It's sandboxed in its own environment, and doesn't pass events back to the browser.

Conceptually, this isn't necessarily a bad thing. What happens when Flash wants to listen to a ctrl + n event? Should the browser take focus away from Flash because it uses that hotkey already? It'd be a real pain for Flash developers, that is for sure.

There have been proposals on how to fix this issue that I've seen for particular browsers, but there's no catch-all solution. For example, this solution is referenced in the bug, but it obviously won't work the way you want (since the user will have to jump through quite a few hoops to get it working).

So... no, for now. Would be really neat if this problem could be fixed.

like image 145
Dan Lew Avatar answered Sep 27 '22 21:09

Dan Lew


Closest you could get is to have ActionScript trigger Javascript to open a blank window to a blank URL

// We abstract it in a function here in case we want to
// change it later
function openBlankWindow()
{
   window.open( '' );
}

For most people, this will launch a new window or a new tab (depending on their browser preferences) but since it is being initiated by the web page, may be subject to pop-up blockers.

There is no way to actually ask the browser to specifically do one of the two tasks you are asking about. I would be a security/annoyance nightmare if web pages had the permissions/privileges to do that.

like image 24
Peter Bailey Avatar answered Sep 27 '22 20:09

Peter Bailey