Wp-plugin-change-preview-target is a project mainly written in PHP, it's free.
This is WordPress plugin for changing target attribute when preview.