4

I'm building a WinJS app which is using iframes to display web pages.

When testing and running the application I am bombarded with "Access Denied" errors.

I'm not trying to interact with the iframe contents. I'm just trying to display the web page.


This is how I'm displaying external web pages within the app.

<iframe src="http://imgur.com/Yk299"></iframe>

This is an example of the errors thrown.

Exception was thrown at line 17, column 363 in       
http://partner.googleadservices.com/gampad/google_ads_gpt.js

0x80070005 - JavaScript runtime error: Access is denied.

I have no idea how to deal with this.

If these errors can be ignored is there any way to set Visual Studio to ignore them?

Help would be great.

3 Answers 3

2

A couple of options, depending on your comfort level with what the scripts are doing and their criticality to your app. It looks like quite a few exceptions for the link you provided are from Google ad services; there are others that are Permission Denied from a different source.

You can control which exceptions will trigger a break in the debugger by opening Exception Settings when you hit the first exception (as shown below) or go to the Debug>Exceptions... option (Ctrl+Alt+E) in the Visual Studio menu.

enter image description here

You could also set the sandbox attribute on the iframe. For instance, setting the following eliminated all of the exceptions:

<iframe src="http://imgur.com/Yk299" sandbox="allow-top-navigation"></iframe>

Of course, this has potentially significant implications on app security, so do this only for sites with content that you have vetted and trust.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot for finding time to help me out. These errors were driving me crazy and I've learnt something new as well.
1

Why don't you use the WinJS WebView, for example:

<x-ms-webview id="webview" src="http://www.google.com" style="width: 1024px; height: 768px;">
</x-ms-webview>

They say it is the preferred way to refer to external pages from within a WinJS app.

Comments

0

They can't be ignored. That protection is built in to the web browsers. You are not allowed to access the content of an iframe that has a different domain. You'd have to build your own renderer.

1 Comment

I'm not trying to access the content of the iframe. The problem is javascript errors within the iframe interfering with app debugging + these errors don't appear on Chrome/IE10/Firefox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.