# Accessing WebBrowserComponents sources

**URL:** <https://forum.juce.com/t/accessing-webbrowsercomponents-sources/49834>\
**Category:** General JUCE discussion\
**Created:** [January 25, 2022, 9:29am UTC](https://forum.juce.com/t/accessing-webbrowsercomponents-sources/49834 "2022-01-25T09:29:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [January 25, 2022, 9:29am UTC](https://forum.juce.com/t/accessing-webbrowsercomponents-sources/49834/1 "2022-01-25T09:29:37Z")

</div>

Hi everybody,

I try to implement a login screen and that should create a SSO token. For that to work I need access to the returned data from the server.  
I understand I can get the URL it accessed as well as the URL where it landed with the three callbacks `pageAboutToLoad (const String &newURL)`, `pageFinishedLoading (const String &url)` and `pageLoadHadNetworkError (const String &errorInfo)`.

Is there any way to intercept the returned page for reading? Something like `String getCurrentPageSource()` that you could query from `pageFinishedLoading()`?

If not, could something alike be added please?  
Or is there another way to achieve this?

Cheers!

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [January 25, 2022, 12:18pm UTC](https://forum.juce.com/t/accessing-webbrowsercomponents-sources/49834/2 "2022-01-25T12:18:23Z")

</div>

This topic has been discussed a couple of times on the forum:

> [@Plugin to WebBrowserComponent interaction, and visa-versa](https://forum.juce.com/t/plugin-to-webbrowsercomponent-interaction-and-visa-versa/22992/3):
>
> Bumping will not help here on the forum (especially bumping after your original post is not even a day old). You should look at the source code ([jucer\_LicenseThread.h](https://github.com/WeAreROLI/JUCE/blob/7be889a775c778c6d862817544745c88ca543028/extras/Projucer/Source/Licenses/jucer_LicenseThread.h) and [jucer\_LicenseWebview.h](https://github.com/WeAreROLI/JUCE/blob/7be889a775c778c6d862817544745c88ca543028/extras/Projucer/Source/Licenses/jucer_LicenseWebview.h)) of the Projucer which needs to solve a similar situation: there the main window content is a WebBrowserComponent but the top header is a JUCE component. To send data to the WebBrowserComponent you simply pass some URL parameters and call [WebBrowserComponent::goToURL()](https://www.juce.com/doc/classWebBrowserComponent#a703f3232f580d72125dea4db8e5a0512). You’re webpage will need to decod…

> [@WebBrowser2 - Receiving events from actions in browser](https://forum.juce.com/t/webbrowser2-receiving-events-from-actions-in-browser/41809):
>
> Is it possible to receive events from embedded browser? I’d like to do a login via a webview for the plugin, so I would need to capture a succes/error response. How can I do this?

Would these approaches work for your use-case?

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [January 25, 2022, 12:30pm UTC](https://forum.juce.com/t/accessing-webbrowsercomponents-sources/49834/3 "2022-01-25T12:30:05Z")

</div>

Thank you @reuk,  
Yes, I saw those posts. The second is a bit a different use case.  
I try currently to follow Fabian’s suggestion and use the url from pageAboutToLoad and fetch it myself using URL::readEntireTextStream(). Unfortunately I don’t have access to the post data at that point. I don’t know yet if I need it though.  
I will try then to let the browser load it again, since I cannot set that downloaded data into the webBrowser. I am not sure if the wordpress of my client likes that, it’s worth a shot.

I will report back when I tried those. I try to avoid too many requirements on the server side, since I don’t know the skillset of my client who does the wordpress site themselves.
