cancel
Showing results for 
Search instead for 
Did you mean: 

focus on pop-up window

Former Member
0 Kudos

Hi all,

I am opening a pop-up window from my main screen using

window.open().But I am not able to set focus on it.

I have tried onLoad="self.focus();" ,but it does not work. Then I tried onBlur="self.focus();".But in this case,many elements on the pop-up itself stops working.

How do I disable access to the calling page,once the pop-up comes ? Please help.

Thanks&regards,

Ananya

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Ananya,

Use onload="window.focus()".

You cannot disable access to the calling page, if you are using window.open. But if you use a Modal Dialog Window, then the user can access only the opened window. It is explained in the Advanced BSP Programming book, written by Thomas Jung and Brian McKellar, published by SAP-Press.

Regards

Gladson

Former Member
0 Kudos

Hi Gladson,

Actually I tried with modalDialog .But there,some problem occurs when I am trying to get into the onInputProcessing of the pop-up.I basically want some solution with window.open().However,I will refer to the book and check out.

Regards,

Ananya

athavanraja
Active Contributor
0 Kudos

try the following code.

<script language="javascript" type="text/javascript">
<!--
function popitup(url)
{
	newwindow=window.open(url,'name','height=200,width=150');
	if (window.focus) {newwindow.focus()}
	return false;
}

// -->
</script>

for more on this check out this link.

http://www.quirksmode.org/js/popup.html

Regards

Raja

Former Member
0 Kudos

Hi Raja,

I tried as you have suggested. But what happens is:When I click outside the pop-up window,

the pop-up just disappears( actually gets minimized and remains in the Windows task bar). Supposing, I close the main calling page,the pop-up still remains in minimized status.

But what I need is,when the pop-up comes,I must not be able to click anywhere on the main page.Focus will be confined to the pop-up. Only when user closes the pop-up,focus will come back on main page.

And I have to do all this using window.open..Please help.

Regards

Ananya

athavanraja
Active Contributor
0 Kudos

Hi Sorry,

I missed out the last line (How do I disable access to the calling page,once the pop-up comes ? Please help) in your message.

Let me look for a solution and get back.

Regards

Raja

athavanraja
Active Contributor
0 Kudos

your only option is to use Modal Dialog .

check out this on Modal Dialog.

http://www.webreference.com/js/column90/

What problem are you facing when working with modal dialog.

May be we will try to address the problem you are facing with modal dialog.

Regards

Raja

Former Member
0 Kudos

Hi Raja,

I was repeatedly trying with modalDialog upto now, but in this case sometimes the onInputProcessing of the pop-up works,sometimes not.

Also,various commands like window.opener.close() etc..fails if I use window.showModalDialog because in this case it cannot identify an opener.

Only if I open a pop-up by window.open(), that pop-up can identify commands like window.opener.close etc..which I need in this case.

So.Basically I need to make it work with window.open only

Regards,

Ananya

Former Member
0 Kudos

Hi,

I am sorry if I was late in responding. I was trying out before getting back to you.

Regards,

Ananya

athavanraja
Active Contributor
0 Kudos

I understand that.

But i have to do some reading before i could answer further on this.

i am currently readin this http://www.webreference.com/js/tutorial1/dialog.html

you can also try that.

Regards

Raja

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ananya,

use the following Code.

<a href="javascript:show_contact()">[Help&Contact]</a>

<script type="text/javascript">

function show_contact()

{

var url = "contact.htm"

var pw = window.open(url,'Contact','height=300,width=300,top=200,left=100,toolbar=0,location=0,status=0,menuBar=0,scrollBars=1,resizable=1')

<b>pw.focus()</b>

}

</script>

Regards

Aashish Garg

Former Member
0 Kudos

Hi,

Thanks a lot for the replies . They have been helpful.

Regards,

Ananya

Former Member
0 Kudos

Hi,

The problem is not solved yet. Any help on how t solve this with window.open() ?

Regards,

Ananya

Former Member
0 Kudos

Hi Ananya,

Although its a long time since this problem has come up, my recent blog provides a possible solution for the issue.

/people/ravikiran.chittum/blog/2006/08/10/working-with-modal-dialog-in-a-bsp-application

Best Regards,

Ravikiran.