Positioning a browser window from a link

Apr 29, 2013

Is there a way to absolutely position a browser window that opens from a link within Storyline (even in javascript)? I have a client that wishes to have a window open over a certain portion of the course.

Any assistance with this is greatly appreciated.

2 Replies
Steve Flowers

You can do this but it'll take some JavaScript trigger magic to make it happen. You'll need to use a JavaScript trigger to launch your new window as well. A few caveats - a) All browsers have different traits so it'll be close but not pixel perfect unless you deal with each possible case, b) Some browsers require different methods so this will be a little complicated.

Here's how I'd tackle it:

1) Determine the position of the current window. You'll need to do this just in case the user has changed the window position since I'd guess you'll want to have the new popup appear consistently relative to your underwindow.

2) Launch your new window with location properties and size based on the underwindow position.

Here is some should-work-code. If you're not yet comfortable with JavaScript, I may have some time to put together a working example later in the week.

//let's grab the left and top positions of the window

var winLeft=(document.all)?window.screenLeft:window.screenX;

var winTop=(document.all)?window.screenTop:window.screenY;

//now for your window launch code - employing an offset value to position overtop your values and the window location

//change the yahoo address to your launched location

//modify the 300 and 200 values to the size of window you want

//modify the 40 and 100 values to the location of window relative to your underwindow

var newWin=window.open('http://www.yahoo.com','newWindow','width=300,height=200,left='+(winLeft+40)+',top='+(winTop+100)+',scrollbars=0,toolbar=0,location=0,resizable=0');

This discussion is closed. You can start a new discussion or contact Articulate Support.