WinJS - Ignore iframe javascript errors

I am creating a WinJS application that uses iframes to display web pages.

When testing and launching the application, they bombard me with access denied errors.

I am not trying to interact with iframe content. I'm just trying to display a webpage.


This is how I display external web pages in an application.

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

This is an example of errors.

 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 a way to establish that Visual Studio ignores them?

Help would be great.

+4
source share
3 answers

Several options, depending on your level of comfort, with what the scripts do, and their criticality for your application. It looks like you will find some links to the provided link in Google advertising services; there are others that are allowed through another source.

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

enter image description here

You can also set the sandbox attribute to an iframe. For example, setting the following exceptions excludes all exceptions:

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

Of course, this has potentially significant implications for application security, so only do this for sites with content that you have verified and trusted.

+2
source

Why aren't you using WinJS WebView, for example:

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

This is said to be the preferred way to link to external pages from a WinJS application.

+1
source

They cannot be ignored. This protection is built into web browsers. You are not allowed to access iframe content with a different domain. You will need to create your own renderer.

0
source

All Articles