Can you please give an example on how to “use javascript to fetch content of a website and pass it to your C# script” without opening a browser window?
It’s probably very simple, but I cannot figure it out without documentation
For now I only found a way to do it after page loads in a browser like this:
private string javaScriptCode = “UnityInAppBrowser.sendMessageFromJS(document.documentElement.outerHTML)”;
void Start() {
InAppBrowserBridge bridge = FindObjectOfType<InAppBrowserBridge>();
bridge.onBrowserFinishedLoading.AddListener(Execute);
bridge.onJSCallback.AddListener(OnMessageFromJS);
}
private void Execute(string command)
{
InAppBrowser.ExecuteJS(javaScriptCode);
}
void OnMessageFromJS(string jsMessage)
{
var filePath = Application.persistentDataPath + “/savedPage.html”;
File.WriteAllText(filePath, jsMessage);
}