PDA

View Full Version : QWebView setHtml embedded javascript error



mvbhavsar
30th January 2017, 21:16
Hello

I am developing an application in which I am using qwebview to show html content .

I have below code in QString



<!DOCTYPE html>
<html>
<head>
<title>Sample page</title>
<base href="/">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<form role="form">
<div class="container-fluid">
<input class="form-control" type="text"/>
<Button class="form-control">Submit</Button>
</div>
</form>

</body>
</html>


Once this code is stored on QString, I have called below code

[code]
view->setHtml(htmltxt,QUrl::fromLocalFile(QDir::current( ).absoluteFilePath("index.html")));

[\code]

Although, contents are displayed in qwebview but it is unable to load link tag with bootstrap.min.css and style is not getting applied.

Can somebody help me in this.

Thanks

Manish