Solved

Access Denied Error is coming while accessing showModaDialog for internet sites

Posted on 2011-09-20
13
1,802 Views
Last Modified: 2012-05-12
Access Denied Error is coming while accessing show modal dialog at this line window.showModalDialog(url,"","") if popupblocker is turned on and when the url's are internet sites(like amazon.com ,google.com etc) .if i put google.com in place of url then i am getting Access Denied Error and because of that popup window not coming.

if i add these sites in popup up blocker settings irrespective of  popupblocker is turned on/off then modal dialog is coming.

if below function is deployed in local sites then its working fine.

 Is there anyway for below modal window getting called for internet sites if popupblocker is turned on?

<HTML>
 <HEAD>
  <TITLE>    onbeforeunload .
 </TITLE>
  <script>
window.onbeforeunload =close;


function close()
{
window.showModalDialog("HTTP://WWW.GOOGLE.COM","","");
}
  </script>
 </HEAD>

 <BODY>



 </BODY>
</HTML>
0
Comment
Question by:chaitu chaitu
  • 7
  • 6
13 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36571446
Try wrapping the external site in an iframe and open the local file with that iframe. You can pass the URL to include in the dialogArguments
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 36571574
i didnt understand much.am very much need of this requirement.

can you provide some sample code on how to accomplish this requirement or provide some links?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36571648
function close()
{
window.showModalDialog("iframePage.html",{URL:"HTTP://WWW.GOOGLE.COM"},"");
}


and in iframepage.html:

<script>
document.write('<iframe src="'+window.dialogArguments.URL+'" style="width:100%;height:100%"></iframe>')
</script>
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 20

Author Comment

by:chaitu chaitu
ID: 36571818
Thanks for the suggestion.actually my assumption was wrong so asked wrongly.sorry for the inconvenience.

This is our problem.

Lets assume that  our application is deployed in domains like --google.com or amazon.com etc.

if i follow your approach i need to place iframepage.html in google.com server.
so i need to access it like http://google.com/iframepage.html;

the problem is in IE, if poup blocker is turned on(prevent popups to display) then it is restricted to open popup  because the application is deployed in external sites i.e its  accessing like http://google.com/iframepage.html;

 
 if i add above sites in popup up blocker settings irrespective of  popupblocker is turned on/off then modal dialog is coming.if i don't add these sites
 in setting then access denied is coming because we are acessing external sites.

 but normally no user will add the sites in popup up blocker settings.

 I hope that i clearly explain the problem.

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36571902
That is not what I meant

You need iframepage.html on YOUR server and you just pass the url it should load
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 36572196
i will try out you option and let you know the result.

but still i hav doubt here .

even though i placed the iframepage.html on OUR server  but modal window is trying to open url  that is internet site i.e. http://www.google.com/iframepage.html;

window.showModalDialog("iframePage.html",{URL:"HTTP://WWW.GOOGLE.COM"},"");
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 36573125
As you said I have written the below code and turn on the popup blocker in IE8.

I have accessed the application it in debug mode and at the below line of code getting 'access is denied' and after that browser is getting closed.

window.showModalDialog("iframePage.html",{URL:"HTTP://WWW.GOOGLE.COM"},"");
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 36573336
until you enter the websites to allow in pop up blocker settings then only pop up is coming in case of pop up is turned on.

any comments?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36573576
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 36573705
I dont know which version of IE your are checking .Please turn on your pop up blocker and check .

but when i check in IE8 and  turn on the pop up blocker and close the browser its closing.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36575139
Hmm - I did not turn the blocker ON - because then it does not matter from where the popup comes from

if I click the link in IE8 on XP, I get the popup.
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 36578551
our requirement is  even though user has turned pop blocker  is ON then also popup must come.

normally users turn on the pop up blocker to restrict the popups.

in your example i clicked the browser close button its simply closing this is not what i required.

"if I click the link in IE8 on XP, I get the popup."

Did you turn the blocker ON ??
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 36579278
No it must be of course be turned off for the site that instigates the popup for it to work.

I assumed your problem was the fact that you popped a page from a different domain.

You cannot pop anything onbeforeonload or from script if popup blockers are turned ON for the site you are on,  ONLY from links or forms with target="_blank"

Sorry to be the messenger of bad news, but I did not design the security for the browsers.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question