Solved

Access Denied Error is coming while accessing showModaDialog for internet sites

Posted on 2011-09-20
13
1,792 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to create an extensible mechanism for linked drop downs.
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…

778 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