0

I want to load just one part of the webpage(e.g. login button of my webpage) in my personal computer application which is written by Qt(version: 5.12.4) but I couldn't find anything which can help me to do this. I think it should have one solution to load iframe/frame or something like these. For example, the webpage has following content and I want to load button2 in my application.

<!DOCTYPE html>
<html>
<body>

<button id="button1" type="button" onclick="alert('Hello world1!')" >Click button1</button>
<button id="button2" type="button" onclick="alert('some other hi!')" >Click button2</button>
<button id="button3" type="button" onclick="alert('Hello there!')" >Click button3</button>

</body>
</html>

I can load the whole page easily as follow but the challenge is how to load just a proper component like button with button2 id.

Rectangle {
       id: LoginButton
       width: 200
       height: 50
       WebEngineView {
             anchors.fill: parent
             url: "http://my-url-address.com"
        }
 }

Any idea?!

HRZ
  • 98
  • 7
  • Explain yourself better, what do you mean by a part of a page? – eyllanesc Jul 01 '19 at 07:26
  • One component in the webpage, for example, a proper button in a webpage which has some other component in it. @eyllanesc – HRZ Jul 01 '19 at 07:45
  • Nothing is clear, maybe giving an example of the input (maybe html, url, etc) and what you want to obtain (an image, functionality, etc). – eyllanesc Jul 01 '19 at 07:47
  • Your request is strange, maybe you have an [XY problem](https://meta.stackexchange.com/questions/66377), why do you want to do it? What is your bottom line? If the component depends on another then what should happen in that case? – eyllanesc Jul 01 '19 at 09:29
  • I want to load my google login button of my web site in my application instead of calling APIs directly in Qt code, because it seems QOAuth2AuthorizationCodeFlow has problem in Qt ( https://stackoverflow.com/questions/56113710/invalid-grant-issue-with-google-oauth-authentication-in-qt ), so I decided to do this. @eyllanesc – HRZ Jul 01 '19 at 09:54
  • I understand a bit your background objective, but I do not fully understand your strategy, do you want to have a form made with QML/Qt and send that information using Qt WebEngine ?, if so I do not see any need to render anything on the page, you could do click using js. If you explain to me in more detail what you want, I could give you another approach. – eyllanesc Jul 01 '19 at 10:00
  • Ok, let's have a real example. A good example of what I want to do is what Blizzard company do in their application(https://www.blizzard.com). In their application, if you click on google-login button their web site will be opened and you could log in with Google on their web site and after that, you will be logged in automatically in their application too.@eyllanesc – HRZ Jul 01 '19 at 12:04
  • 1
    So load Google login page inside WebView. Loading part of html sounds very strange since your button probably calls a script which part of the html page. – folibis Jul 01 '19 at 13:51

0 Answers0