So i have ask this question a few days ago the issue is that i have changed the user agent for the browser and it works as it can load whatsapp,but the issue came back whenever i refresh or logout from whatsapp web.i have a video(link) and code with some explaination clipped with this question to make things more clear as per request from D.L. **Statement:sorry but i don't think i can shorten the code as the whole code is needed to show how it works
Code:
import sys
from PySide6.QtCore import QUrl
from PySide6.QtWidgets import *
from PySide6.QtWebEngineWidgets import QWebEngineView
class Widgets(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setWindowTitle("Simple Web Browser")
self.widget = QWidget(self)
self.webview = QWebEngineView()
#change the user agent
self.webview.page().profile().setHttpUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.75 Safari/537.36")
#the link to whatsapp web
self.webview.load(QUrl("https://web.whatsapp.com/"))
self.check_button = QPushButton("Refesh")
self.check_button.clicked.connect(self.button_clicked)
self.toplayout = QHBoxLayout()
self.toplayout.addWidget(self.check_button)
self.layout = QVBoxLayout()
self.layout.addLayout(self.toplayout)
self.layout.addWidget(self.webview)
self.widget.setLayout(self.layout)
self.setCentralWidget(self.widget)
def button_clicked(self):
#reload the webpage
self.webview.reload()
#print out the user agent
print(self.webview.page().profile().httpUserAgent()+"\n")
if __name__ == "__main__":
app = QApplication(sys.argv)
window = Widgets()
window.show()
sys.exit(app.exec())
i can't seem to find any current available solution,so i ask here hoping someone that can solve this issue,what i request is that the whatsapp page can be loaded even after refresh and logout.