Wednesday, June 21, 2017

New Window Bookmarklet

I am a "New Window" link junkie. I use that link ALL THE TIME! If it were possible to wear it out, mine would be worn out. I wish all PeopleSoft pages had the "New Window" link. For some reason, however, certain developers chose to remove it from specific PeopleSoft pages (such as Structure and Content). I'm sure there is a good reason... there just has to be. So seeing it missing from Fluid has been a significant struggle for me. I'm thankful for Sasank's Fluid UI - New Window Feature - Workaround customization. For quick access to a new window without customization, I have a Bookmarklet, which is a JavaScript fragment masquerading as a favorite (or bookmark). Here is the JavaScript:

(function() {
  var parts = window.location.href.match(/(.+?\/ps[pc])\/(.+?)(?:_\d+?)*?\/(.*)/);
  window.open(parts[1] + '/' + parts[2] + '_newwin/' + parts[3], '_blank');
}())

To add it to your bookmark toolbar, drag the following link into your link toolbar:

PS New Window

This solution is simple, but may not satisfy your requirements. This bookmarklet assumes you want to open a new window to the URL displayed in the address bar. That URL may or may not match the actual transaction. If you want a bookmarklet that opens a new window specifically targeting the current transaction, then try this bookmarklet:

(function() {
  var href = window.location.href;
  var parts = (!!frames["TargetContent"] ? !!frames["TargetContent"].strCurrUrl ? frames["TargetContent"].strCurrUrl : href : href).match(/(.+?\/ps[pc])\/(.+?)(?:_\d+?)*?\/(.*)/);
  window.open(parts[1] + '/' + parts[2] + '_newwin/' + parts[3], '_blank');
}())

To use it, drag the following link into your bookmark toolbar:

PS New Window

Special shout out to David Wiggins, who posted a similar bookmarklet on my Where is My New Window Link? post as I was writing this blog post.

3 comments:

Unknown said...

I also felt the need for the new window bookmarklet recently and worked out the "new window same URL" version... but what I really wanted was the "new window same transaction" one. Thanks!

unavailable man said...

You have saved me and my company a headache with this. We used to sue the FireFox add-in "MultiFox" to load separate sessions of PeopleSoft when there was no "New Window" link to be found and the user needed a new window then.

MultiFox support was discontinued in the latest FireFox releases; so I have been looking for a way to make this work... and I just happened to stumble across your blog post when researching how to create my own "New Window" link.

Thank you so much for posting this, your my hero for the day.

Maria said...

This is GREAT! I was working on a WorkCenter today and noticed I didn't have the New Window hyperlink so this was perfect timing. I think the other one will prove userful when using Page & Field Configurator. I can't wait to see your next tip!

Thanks!