1

I've built an C# UWP app showing some HTML content I get from WordPress inside a WebView.

Now I'd like to show some ads inside that WebView below the HTML content. I don't want to use the C# Ads SDK.

According to the docs, I need to manually add the WinJS library (which I've done) and also install and reference the Microsoft Advertising SDK. However, since the project is a C# UWP app I can't reference the Microsoft Advertising SDK for JavaScript.

<!-- Advertising required references -->
<script src="//Microsoft.Advertising.JavaScript/ad.js"></script>

How can I reference the necessary ad.js file? Can I somehow download or extract this from the SDK? Or is there another, official way to do this?

Thomas
  • 4,030
  • 4
  • 40
  • 79

1 Answers1

0

Now I'd like to show some ads inside that WebView below the HTML content.

In WinJS UWP application, you could use html as ad container to display AD, but in C# UWP it's not allowed. Because, you could not get Microsoft.Advertising.JavaScript sdk with <script src="//Microsoft.Advertising.JavaScript/ad.js"></script>, and it is not available in C# UWP project even if you copy the ad.js to C# UWP project manually.

The best practice that implement AD in C# UWP project is to use Microsoft Advertising SDK for XAML for the detail steps please refer AdControl in XAML and .NET.

Nico Zhu
  • 32,367
  • 2
  • 15
  • 36
DasiyTian_1203
  • 1,038
  • 1
  • 6
  • 16