I'm trying to add Fancybox to my ASP.NET MVC application but I'm having some troubles.
As you can see, I added references to jQuery and Fancybox. The css is incapsulated inside of my style.css. And all the pictur开发者_如何学运维es are in the right place.
<link rel="stylesheet" href="/Content/style.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/Scripts/jquery.fancybox-1.2.6.pack.js"></script>
Well, I added this lines to fire up the Fancybox plugin:
<script type="text/javascript">
$(document).ready(function() {
$("a.zoom").fancybox(); // The a with zoom class
});
</script>
Then I have the link:
<a class="zoom" href="http://www.nytimes.com">This goes to iframe</a>
But when I click on the link I get a: Microsoft JScript runtime error: Permission denied alt text http://img265.imageshack.us/img265/7738/screenshot20091123at352.png
And this is my screen after that: alt text http://img14.imageshack.us/img14/7738/screenshot20091123at352.png
I don't know what to do. I'm desperate because I've spent all my day trying to figuring out what's happening. Please, help! :)
You need to add the class 'iframe' to the link to tell fancybox to use an iframe to load the content to avoid a conflict with the same origin policy. The same origin policy prevents the browser from downloading external content via AJAX. Alternatively it appears you can add a ?iframe
parameter to the URL and achieve the same effect.
精彩评论