btoa() and atob() methods are not working despite they're declared here WindowBase64.cs
Steps to Reproduce// 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.
Notevar service = new JsScriptingService(); var result = service.EvaluateScript(document, "btoa('test')"); Console.WriteLine(result);
Exception: System.Reflection.TargetException: 'Object does not match target type.'
generated in EngineExtensions (Call method).
When appending these lines:
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