admoore
13th July 2012, 04:54
Hello, I'm new to these forums. I have posted this question to the PyQT mailing list several weeks ago, but got no response whatsoever, so I thought I'd try here.
I have a web browser application written in PyQt4 which uses a subclassed QWebView. If I load a URL that is password protected, or uses a web session (such as php session) for security, and then subsequently click a link that opens a new window (e.g. target="_blank" or javascript window.open()), the new window opens without authentication or session data and a 403 error results.
The following code illustrates this problem by opening a password-protected page on my website where you can click a link with "target=_blank" set.
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
import sys
class mybrowser(QWebView):
def __init__(self, parent=None):
super(mybrowser, self).__init__(parent)
url = QUrl ("http://www.alandmoore.com/wwwtest")
url.setUserName("test")
url.setPassword("test123")
self.load(url)
def createWindow(self, type):
self.w = mybrowser()
self.w.show()
return self.w
if __name__ == '__main__':
app = QApplication(sys.argv)
w = mybrowser()
w.show()
app.exec_()
How can I get new windows to retain the security credentials of the parent window?
I have a web browser application written in PyQt4 which uses a subclassed QWebView. If I load a URL that is password protected, or uses a web session (such as php session) for security, and then subsequently click a link that opens a new window (e.g. target="_blank" or javascript window.open()), the new window opens without authentication or session data and a 403 error results.
The following code illustrates this problem by opening a password-protected page on my website where you can click a link with "target=_blank" set.
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
import sys
class mybrowser(QWebView):
def __init__(self, parent=None):
super(mybrowser, self).__init__(parent)
url = QUrl ("http://www.alandmoore.com/wwwtest")
url.setUserName("test")
url.setPassword("test123")
self.load(url)
def createWindow(self, type):
self.w = mybrowser()
self.w.show()
return self.w
if __name__ == '__main__':
app = QApplication(sys.argv)
w = mybrowser()
w.show()
app.exec_()
How can I get new windows to retain the security credentials of the parent window?