I have 2 WebViews, which load 2 webpages.
How do I swap their contents? So I would get the content of one WebView, and set the content of the other WebView to this, and visa versa?
Any help would be greatly appreciated.
Thanks in advance.
I think it would be something like
[_mainWebView setContent:_subWebView];
But I can’t find anything for it.
EDIT: I think I’d have to use WebView’s WebFrame, but how do I set it?
Something like the following might work.
Sample GitHub project at: https://github.com/NSGod/SwapWebViews
I used two
NSBoxs placed in the window, and the 2WebViews are separate like shown in the image below:The Swap Webviews button’s method simply calls
NSBox‘ssetContentView:with the desiredWebViews.