The web browser programmed cannot support whatsapp web
-
So i have been testing out on the code available online on how to code a web browser,the solution out there are pretty much the same and it's workable,the problem is when it comes to whatsapp,it cannot be supported and it shows this instead
for my notice the QT is using chromuim as base so it should have no problem excessing whatsapp,and i have tried it using pyqt5 and pysite6 along with pyqt 6 too but still the same result , do we have any solution regarding this?code in pysite6
import sys
from PySide6.QtCore import QUrl
from PySide6.QtWidgets import QApplication, QHBoxLayout, QLineEdit
from PySide6.QtWidgets import QMainWindow, QPushButton, QVBoxLayout
from PySide6.QtWidgets import QWidget
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() self.webview.load(QUrl("https://web.whatsapp.com/")) self.webview.urlChanged.connect(self.url_changed) # Ir hacia atrás self.back_button = QPushButton("<") self.back_button.clicked.connect(self.webview.back) # Ir hacia adelante self.forward_button = QPushButton(">") self.forward_button.clicked.connect(self.webview.forward) # Actualizar la página self.refresh_button = QPushButton("Refresh") self.refresh_button.clicked.connect(self.webview.reload) # Barra de direcciones self.url_text = QLineEdit() # Cargar la página actual self.go_button = QPushButton("Enter") self.go_button.clicked.connect(self.url_set) self.toplayout = QHBoxLayout() self.toplayout.addWidget(self.back_button) self.toplayout.addWidget(self.forward_button) self.toplayout.addWidget(self.refresh_button) self.toplayout.addWidget(self.url_text) self.toplayout.addWidget(self.go_button) self.layout = QVBoxLayout() self.layout.addLayout(self.toplayout) self.layout.addWidget(self.webview) self.widget.setLayout(self.layout) self.setCentralWidget(self.widget) def url_changed(self, url): self.url_text.setText(url.toString()) def url_set(self): self.webview.setUrl(QUrl(self.url_text.text()))
if name == "main":
app = QApplication(sys.argv)
window = Widgets()
window.show()
sys.exit(app.exec())code in pyqt5
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *class MyWebBrowser():
def init(self):
self.window = QWidget()
self.window.setWindowTitle("Web Browser")self.layout = QVBoxLayout() self.horizontal = QHBoxLayout() self.url_bar = QTextEdit() self.url_bar.setMaximumHeight(30) self.go_btn = QPushButton("Go") self.go_btn.setMinimumHeight(30) self.back_btn = QPushButton("<") self.back_btn.setMinimumHeight(30) self.foward_btn = QPushButton(">") self.foward_btn.setMinimumHeight(30) self.horizontal.addWidget(self.url_bar) self.horizontal.addWidget(self.go_btn) self.horizontal.addWidget(self.back_btn) self.horizontal.addWidget(self.foward_btn) self.browser = QWebEngineView() self.go_btn.clicked.connect(lambda:self.navigate(self.url_bar.toPlainText())) self.back_btn.clicked.connect(self.browser.back) self.foward_btn.clicked.connect(self.browser.forward) self.layout.addLayout(self.horizontal) self.layout.addWidget(self.browser) self.browser.setUrl(QUrl("https://web.whatsapp.com/")) self.window.setLayout(self.layout) self.window.show()
app = QApplication([])
window = MyWebBrowser()
app.exec_() -
So i have been testing out on the code available online on how to code a web browser,the solution out there are pretty much the same and it's workable,the problem is when it comes to whatsapp,it cannot be supported and it shows this instead
for my notice the QT is using chromuim as base so it should have no problem excessing whatsapp,and i have tried it using pyqt5 and pysite6 along with pyqt 6 too but still the same result , do we have any solution regarding this?code in pysite6
import sys
from PySide6.QtCore import QUrl
from PySide6.QtWidgets import QApplication, QHBoxLayout, QLineEdit
from PySide6.QtWidgets import QMainWindow, QPushButton, QVBoxLayout
from PySide6.QtWidgets import QWidget
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() self.webview.load(QUrl("https://web.whatsapp.com/")) self.webview.urlChanged.connect(self.url_changed) # Ir hacia atrás self.back_button = QPushButton("<") self.back_button.clicked.connect(self.webview.back) # Ir hacia adelante self.forward_button = QPushButton(">") self.forward_button.clicked.connect(self.webview.forward) # Actualizar la página self.refresh_button = QPushButton("Refresh") self.refresh_button.clicked.connect(self.webview.reload) # Barra de direcciones self.url_text = QLineEdit() # Cargar la página actual self.go_button = QPushButton("Enter") self.go_button.clicked.connect(self.url_set) self.toplayout = QHBoxLayout() self.toplayout.addWidget(self.back_button) self.toplayout.addWidget(self.forward_button) self.toplayout.addWidget(self.refresh_button) self.toplayout.addWidget(self.url_text) self.toplayout.addWidget(self.go_button) self.layout = QVBoxLayout() self.layout.addLayout(self.toplayout) self.layout.addWidget(self.webview) self.widget.setLayout(self.layout) self.setCentralWidget(self.widget) def url_changed(self, url): self.url_text.setText(url.toString()) def url_set(self): self.webview.setUrl(QUrl(self.url_text.text()))
if name == "main":
app = QApplication(sys.argv)
window = Widgets()
window.show()
sys.exit(app.exec())code in pyqt5
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *class MyWebBrowser():
def init(self):
self.window = QWidget()
self.window.setWindowTitle("Web Browser")self.layout = QVBoxLayout() self.horizontal = QHBoxLayout() self.url_bar = QTextEdit() self.url_bar.setMaximumHeight(30) self.go_btn = QPushButton("Go") self.go_btn.setMinimumHeight(30) self.back_btn = QPushButton("<") self.back_btn.setMinimumHeight(30) self.foward_btn = QPushButton(">") self.foward_btn.setMinimumHeight(30) self.horizontal.addWidget(self.url_bar) self.horizontal.addWidget(self.go_btn) self.horizontal.addWidget(self.back_btn) self.horizontal.addWidget(self.foward_btn) self.browser = QWebEngineView() self.go_btn.clicked.connect(lambda:self.navigate(self.url_bar.toPlainText())) self.back_btn.clicked.connect(self.browser.back) self.foward_btn.clicked.connect(self.browser.forward) self.layout.addLayout(self.horizontal) self.layout.addWidget(self.browser) self.browser.setUrl(QUrl("https://web.whatsapp.com/")) self.window.setLayout(self.layout) self.window.show()
app = QApplication([])
window = MyWebBrowser()
app.exec_()@101-Wizard
Does following https://forum.qt.io/topic/110567/qwebengineview-issue/2 and https://bugreports.qt.io/browse/QTBUG-81314 resolve this? It's just a user agent string issue. -
@101-Wizard
Does following https://forum.qt.io/topic/110567/qwebengineview-issue/2 and https://bugreports.qt.io/browse/QTBUG-81314 resolve this? It's just a user agent string issue.@JonB solve but now for long.a refresh button or log out from whatsapp will straight show the same problem again
-
@101-Wizard
Does following https://forum.qt.io/topic/110567/qwebengineview-issue/2 and https://bugreports.qt.io/browse/QTBUG-81314 resolve this? It's just a user agent string issue.@JonB i have rework 2 files
Pyside6/PyQt6import sys from PySide6.QtCore import QUrl from PySide6.QtWidgets import QApplication, QHBoxLayout, QLineEdit from PySide6.QtWidgets import QMainWindow, QPushButton, QVBoxLayout from PySide6.QtWidgets import QWidget from PySide6.QtWebEngineWidgets import QWebEngineView from PySide6.QtWebEngineCore import QWebEngineHttpRequest class Widgets(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.setWindowTitle("Simple Web Browser") self.widget = QWidget(self) self.webview = QWebEngineView() self.webview.page().profile().setHttpUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.129 Safari/537.36") self.webview.load(QUrl("https://web.whatsapp.com/")) self.webview.urlChanged.connect(self.url_changed) self.url_text = QLineEdit() self.toplayout = QHBoxLayout() self.layout = QVBoxLayout() self.layout.addLayout(self.toplayout) self.layout.addWidget(self.webview) self.widget.setLayout(self.layout) self.setCentralWidget(self.widget) def url_changed(self, url): self.url_text.setText(url.toString()) def url_set(self): self.webview.setUrl(QUrl(self.url_text.text())) if __name__ == "__main__": app = QApplication(sys.argv) window = Widgets() window.show() sys.exit(app.exec())
PyQt5
from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtWebEngineWidgets import * from PyQt5.QtPrintSupport import * import sys class MainWindow(QMainWindow): def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) self.webview = QWebEngineView() self.webview.page().profile().setHttpUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.129 Safari/537.36") self.webview.setUrl(QUrl("https://web.whatsapp.com/")) self.setCentralWidget(self.webview) self.status = QStatusBar() self.setStatusBar(self.status) self.show() app = QApplication(sys.argv) app.setApplicationName("Whatsapp") window = MainWindow() app.exec_()
somehow Pyside6/pyqt6 works bettter then pyqt5,i mean after refresh it return back to the problem,but still after closing and rerun the file it starts over again for Pyside6,tho for pyqt5 i just need to refresh once and the whole thing will go back to the problem once again no matter how many times i close and rerun the file