Solved

Access Denied Error is coming while accessing showModaDialog for internet sites

Posted on 2011-09-20
13
1,765 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now