You need to be logged in to post in the forums. If you do not have an account, please sign up first.
Please make middle-clicking on javascript "open new window" links work!
The middle-click open in background function is a fantastic feature I use all the time, but the links that, when you hover the mouse over them, say "Address: javascript: ol('http://www.anadress.com')", always open a blank tab on middle click. Any chance of making this work?EDIT: While I'm on the subject, how about making it work on the bookmarks menu too? But maybe that's a windows limitation, I don't know.
Also, can you make image captions/alt-text visible on image tooltips, as in IE, in addition to the actually useful address information Opera usually gives? Or is there a setting for this I've not found yet?
Originally posted by YourMessageHere:
The middle-click open in background function is a fantastic feature I use all the time, but the links that, when you hover the mouse over them, say "Address: javascript:ol('http://www.anadress.com')", always open a blank tab on middle click. Any chance of making this work?
+1. I use an user CSS file to `mark' javascript links on hover with an orange border:
a:hover[href^=javascript], a:hover[onclick] {
outline: 2px solid #F80;
}
Originally posted by YourMessageHere:
Also, can you make image captions/alt-text visible on image tooltips, as in IE, in addition to the actually useful address information Opera usually gives? Or is there a setting for this I've not found yet?
The following UserJS ( about this feature: http://www.opera.com/support/tutorials/userjs/ ) will add a title attribute with the same value as the alt attribute to every image:
http://scripts.userjs.org/browser/enhancements/add-alt-text.js
[ Tweedo Monitor - Deluxe Website & Service Monitoring ]
Originally posted by hermen2048:
See http://userjs.org/scripts/browser/enhancements/link-alertI use an user CSS file to `mark' javascript links on hover with an orange border
Originally posted by YourMessageHere:
Cool, thanks. Nonetheless it'd be nice to see as a built-in option (especially as it's clearly simple to do if you have some idea what you're doing with Java).
It's not as simple as it would seem. There isn't only one way to open links with javascript and implementations differ from site to site. Typically it's a call to a custom procedure named for example openPopup() which calls the appropriate procedure to open a popup window with specified parameters.
The problem is, the method could be relying on some variable or call another method declared in the scope of the current page. Therefore, you would have to have the entire scope of the current page present for the method to execute properly.
Executing openPopup() in a new (blank) tab will obviously not work because it wasn't declared there. But, for it to work, the entire page where the function is called from would have to be loaded in this tab for it to work properly. So it would have to do something like duplicate the tab then execute the javascript (which would open another new tab).
But, since there are some links with javascript in them which do not open popup windows but do other stuff, just duplicating the current tab would probably have some negative consequences...
So I don't think it's that trivial a matter.
But writing such links is just bad practice as it obviously breaks navigation. (Think for example users who disable javascript or browing on mobile devices). This is something web authors would have to correct. There is a proper way of opening such popup windows - using graceful degradation.
It's actually very simple - you create a link pointing to the page you want to display in a custom popup. Then, you give that link an event onclick="javascript:pop();return false;" The pop() method will open the link in a popup window with javascript and the return false will "consume" the click so the browser will not open the link like it would normally. But, if you middle-click on the link, the browser will follow the link specified in the HREF variable, so it will open the link in a new blank tab.
You actually can see an example of this the opera front page: www.opera.com
Try left clicking on the picture of the mobile phone. It opens an AJAX popup window.
Now middle click it - it opens a page in a new tab!
PS: Also, it's Javascript, not Java. These are two completely different things with a misguidingly similar name.
Of course, i would like to see this feature. But i can't even imagine how it can be implemented...
Convert2PHF.js -- saving in single htm or mht file
(In most cases at least)Enjoy

makesomemiddleclickwork.js
Thats the way it should always B.

A possible fix would be to make JS links open the same page in another window and immediately execute the JS you middle clicked there. But I'm not sure if that's possible.
+ Opera Lover Survival Kit - full of banners, avatars, userbars & other crap nobody can live without

+ Restaurant at the end of the universe - The Hitchhiker's Guide to the Galaxy movie petition
+ Best Opera widgets ever! - Exclusive design, first class usability, minimal CPU usage
Support the quest for 64-bit Opera
I wanted to submit a proposal, and discovered that this had been already been requested!
Originally posted by profiT:
Of course, i would like to see this feature. But i can't even imagine how it can be implemented...
Many, but not all, JavaScript links, can be detected by simple pattern matching.
Things such as:
<a href="javascript:window.location='http://domain-name/http-get-param'">Link</a>
Or variations:
window.open('link')
OpenUrl('link')
window.location.replace('link')
Blocks having a onclick event would be seeked as "JavaScript links" too.
Unfortunately, it would be far more complex to handle JavaScripts that call a user-defined function, even for dumb functions such as:
function popup(link) {
window.open(link);
}
Because the function may be modified by another script executed somewhere in the page.
popup=function(link) {} // Replace the function by a function doing nothing.
At best, it might be possible to detect a JavaScript link by exploring the JavaScript namespace at the time the link is "used": Right-clicked or middle-clicked or the tooltip is ready to display when hovering it.
Predicting whether a JavaScript function is a dumb linking function will, of course, not always work.
Only links matching specific patterns would be detected.
Now here is how I wish that these links be treated:
I would like that they be treated as much as normal anchors as possible but there would be a special indication that these are not normal links when the tooltip is displayed when hovering the mouse on the link. Among other things, it would indicate the behavior of the JavaScript: For example "popup" or "open in current window".
Moreover, opening them (e.g. by clicking on them) would, by default, produce the same behavior than the JavaScript is supposed to do. For example, for a "popup" JavaScript, it would open the new page in a popup window.
But, for any other thing, they would behave as normal links:
- The usual tooltip "Address:<URL>" would be displayed when the user hover the cursor on them.
- Middle click and other user shortcuts would work as for normal links.
- Right clicking on them would popup the usual menu, with the usual options:
- Open
- Open in new tab
- Open in background tab
- Open in new window
- Open in background window
- Bookmark link
- Copy link address
- Save target as...
- Save to download folder
[*] The "search in links" feature of Opera would search into them.
[*] Future features of Opera would treat them as normal links.
[/list]
I request an additionnal feature: An option "Open in current window" would be added to the menu of links. This would override the default behavior of opening popup JavaScripts into popups...
There would be a user configurable shortcut to this option. The default would be CTRL+CLICK or anything easy to use.
It would even be possible to configure the default behavior of mouse left click to be "Open in current window".
This feature would also work for links having a target attribute.
I know that detecting JavaScript links would be difficult and that many of them would not be detected.
But I'm sure that many of these awful JavaScript things can be detected and transformed into true links.
Win 7 / Ubuntu 10.10 | iPlus | Kontakt: Jabber/XMPP: dj_pajak@aqq.eu GG: 10188713 | Moje skórki: Z1-Glass
ReactOS | Opera Desktop Team Blog | How/where do I report bugs? Upload plików na forum powraca!