Remove blank targets

Stops most links from opening to new windows.

Opera has long had a setting to more or less intelligently ignore the target attribute on elements so that new windows don't open on links while still allowing frames to function. Unfortunately this setting also disables the window.open() method, breaking the functionality of many sites.

This script aims to reduce the amount of new windows without interfering with frames, window.open() or named windows for panels. Rather than removing them outright as the script's name suggests, blank targets are changed to _top so that the intended destinations will break out of framesets when appropriate.

Installation Instructions: 

To install UserJS files you must first create a folder for them on your PC. Where you create this folder and what you call it is entirely up to you. Next, go to file->preferences->advanced->content->Javascript Options and select the User Javascript folder you just created. Then, download the .js file from this site and put it in the folder. 

If you are using Opera 10.10 or later you can use the UJS manager Unite application to install and manage your scripts. If you have it installed, simply open the script in Opera and an installation button will appear.

Scripts take effect on a page after reloading it.

Tested with Opera version(s): 
10.50
Your rating: None Average: 5 (12 votes)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thx!

Very useful script, thanks. :)

the better way

opera:config#UserPrefs|SingleWindowBrowsing

except it isn't

SingleWindowBrowsing isn't better as it disables an essential function for browsing in the process:

Opera has long had a setting to more or less intelligently ignore the target attribute on elements so that new windows don't open on links while still allowing frames to function. Unfortunately this setting also disables the window.open() method, breaking the functionality of many sites.

I actually wasn't aware of

I actually wasn't aware of that setting.  I was thinking, rather, of opera:config#UserPrefs|IgnoreTarget, which prevents window.open() from functioning at all.  SingleWindowBrowsing is indeed a good alternative, as it seems to play nice with panels and does allow window.open() to work, but if a page in question requires an action in an open()ed window to affect the host document, you're out of luck, because you can't middle-click to open it as a window.  Still, it works for most cases, and I'm glad Mr. anonymous pointed it out, but I still prefer my script, since it errs on the side of caution.

Many thanks. Just what was

Many thanks. Just what was needed.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

By submitting this form, you accept the Mollom privacy policy.