Answer the question
In order to leave comments, you need to log in
Is it possible to inject qjsonobject into a browser?
I am using qtwebkit and trying to add some json object to the page. I suspect that this can be done through evaluateJavaScript. Maybe there is another possibility?
And how to return a js object from a function that is injected through addToJavaScriptWindowObject?
Answer the question
In order to leave comments, you need to log in
Solved the problem like this:
void InjectJson(QString name, QJsonObject obj){
QJsonDocument doc(obj);
QString json(doc.toJson());
mainFrame()->evaluateJavaScript("var " + name + " = " + json);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question