A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AngleSharp/AngleSharp.Js/issues/55 below:

btoa() and atob() are not working · Issue #55 · AngleSharp/AngleSharp.Js · GitHub

Description

btoa() and atob() methods are not working despite they're declared here WindowBase64.cs

Steps to Reproduce
  1. Create a console application (.NET Framework 4.6.2)
  2. Run this code (from AngleSharp.Samples)
// We require a custom configuration with JavaScript
var config = Configuration.Default.WithJs();

// This is our sample source, we will set the title and write on the document
var source = @"<!doctype html>
<html>
<head><title>Sample</title></head>
<body>
<script>
document.title = 'Simple manipulation...';
//document.write('<span class=greeting>Hello World!</span>');
document.write(btoa('test'));
</script>
</body>";

var document = BrowsingContext.New(config).OpenAsync(m => m.Content(source)).Result;

// Modified HTML will be output
Console.WriteLine(document.DocumentElement.OuterHtml);

Expected behavior:
Oputput: (in browser)

<html><head><title>Simple manipulation...</title></head>
<body>
<script>
document.title = 'Simple manipulation...';
//document.write('<span class=greeting>Hello World!</span>');
document.write(btoa('test'));
</script>dGVzdA==
</body></html>

Actual behavior:
Output:

<html><head><title>Simple manipulation...</title></head>
<body>
<script>
document.title = 'Simple manipulation...';
//document.write('<span class=greeting>Hello World!</span>');
document.write(btoa('test'));
</script>
</body></html>

Environment details: [Win 10, .NET Framework 4.6.2]

It maybe an obvious question as I don't know the way the library works till now, or just don't know the right way to use it.

Note
var service = new JsScriptingService();
var result = service.EvaluateScript(document, "btoa('test')");
Console.WriteLine(result);
var service = new JsScriptingService();
var result = service.EvaluateScript(document, "btoa");
Console.WriteLine(result);

Appended output:

function btoa() { [native code] }

So, it exists but I can't call it, maybe I'm using it the wrong way.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4