0
我的文件如何從pyside qwebview的本地計算機加載JavaScript?
messi_fan.py
barcelona_fan.html
jq.js
在同一目錄下。
messi_fan.py
f = open('barcelona_fan.html', 'r')
html = f.read()
f.close()
self.webView = QWebView()
self.webView.setHtml(html, baseUrl=QUrl('http://local'))
self.webView.show()
barcelona_fan.html
<script type="text/javascript" src = "jq.js"></script>
我的問題是jQuery的在Qwebview不加載。如果我使用這樣的barcelona_fan.html
<script type="text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
一切都會工作。但我想從本地加載.js文件。我可以這樣做嗎?