/    Sign up×
Community /Pin to ProfileBookmark

problem in custom modal dialog implementation for Mozilla

Hi ,

I am trying to implement a custom modal dialogue implementation for Mozilla browser which will act same as showModalDialog of IE.

For achieving the modalDialog functionality i have written a JS function checkFocus() which will be called “onFocus” of the invoking[parent] window.

–> [U]Opening modalwindow[/U] :

modalWin=window.open(url,”modalDialog”,””);

–> [U]Function using for making the opened modalWin as modalDialog [/U]:

function checkFocus()
{

//modalWin is the reference object of window opened that will act as
modalDialog

if (modalWin!=null && !modalWin.closed)
{
self.blur();
modalWin.focus();
}
}

–> [U]Calling the function[/U] :

the above function will be invoked as <body onFocus=”checkFocus();”> from the parent page in which the modalWin has been opened.

It works fine for the normal flow. But if i opened multiple windows of mozilla and one of the windows has my application which invokes the modalDialog, once after the modal dialog is opened if i clicked the parent window, the focus shifts to any other window beside the parent window and modalDialog window.

this is because of self.blur() that i am using in my guess. But the same code is working fine for Safari browser. So i am a bit confused.

Any ideas to resolve the above problem will be appreciated.

Thanks,
kiran

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @kpinnamaneni spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...