JavaScript Window.Open - window opens behind current window

I have a Client Script - JScript assigned to a button in my app. When the button is clicked the window opens in a new browser window, but it opens behind the current window. We have to minimize the browser app in order to see the window opened from window.open. How can I revise the code below to open the window in front of the app window? Thanks!
function AppraisalClick() {
  window.open("\\\\ops047-mw1\\MLCommon2\\Appraisals\\"+document.all.LoanNumber1.value
+".pdf", "_blank");
}

Open in new window

LVL 2
asmyattAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
try:
function AppraisalClick() {
  var child = window.open("\\\\ops047-mw1\\MLCommon2\\Appraisals\\"+document.all.LoanNumber1.value
+".pdf", "_blank");

setTimeout(function(){child.focus();},250);
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
asmyattAuthor Commented:
It still opened behind the current app window.
0
leakim971PluritechnicianCommented:
How do you open it ?

What about the following :

(wait for 10 seconds and don't touch anything on my computer before ! :)


function AppraisalClick() {
  var child = window.open("\\\\ops047-mw1\\MLCommon2\\Appraisals\\"+document.all.LoanNumber1.value+".pdf", "_blank");

setTimeout(function(){child.focus();},10000);
}

Open in new window

0
hieloCommented:
>>It still opened behind the current app window.
The code I gave you above should work. It simply delays focusing by 250 milliseconds (quarter second - Thus if you were to use 1000, you are essentially delaying by ONE second). If anything you may need to play with that number, depending on how long your largest document takes to load.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.