简体   繁体   中英

Microsoft Ads inside UWP Webview

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM