I am wondering how I can get the mime-type of the current page using a QWebPage. Also, if possible, I would like to be able to do this using the HEAD request so I know not to download the whole page if it's not the correct mime-type. Any ideas?
QWebPage, getting the mime type
1.1k Views Asked by Tom Leese At
1
There are 1 best solutions below
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in QT
- qt c++ fonction converting adress to coordinates (longitude, latitude)
- Qml table and chart using python
- Qt: running callback in the main thread from the worker thread
- i have installed qt version 6.0.3 and this error QMYSQL driver not loaded displaying again and again
- Frameless Qt + WinAPI maximized window size is bigger than the availableGeometry()
- new window with c++ qt
- How to get scaling from transformation matrix
- How to build just Qt core libraries from Qt sources
- doxyqml not documenting qml files properly
- Incorrect assignment from a QStringList to a char * array
- How to make QT Chart size larger than widget size?
- Queued async operations with QtConcurrent interfere QImage from freed
- Questions about qt5 dynamic link library
- how to document QML files inside C++ project?
- How do I keep my screen contents centered and also have a scrollbar in QT?
Related Questions in MIME-TYPES
- Invalid mime type \"rss+xml\": does not contain '/'
- I am trying to use pdfjs viewer ver. pdfjs-4.0.379-dist and while running it on XAMPP server i get this error:
- Fb2 UploadedFile mimetype on different OSes not the same
- ActionDispatch::Http::MimeNegotiation::InvalidType ("html" is not a valid MIME type):
- Is it (still) a security flaw to check MIME only by extension?
- Loading module from “http://localhost/js/three.module.js” was blocked because of a disallowed MIME type (“text/html”
- Artifactory - Bad header value content-type of pom.xml from repo.spring.io
- MIME type for reading CSV file in an Android app does not work
- Getting "Mime type error" when deploying a Vite + React project to Firebase, cannot figure this out
- deployment angular 15 project on nginx got server responded with a MIME type of "text/html"?
- Invalid email headers using WordPress wp_mail()
- magento 2.4 - blocked due to MIME type (“text/html”)
- Rapidoid request content type matching
- So I encouter problem in deploying my project it said MIME
- What mime type/format should I use to set the clipboard to allow pasting of data in Google Sheets?
Related Questions in QWEBKIT
- ImportError: cannot import name 'QtWebKitWidgets' from 'PyQt5'
- Print error Pyqt Qwebkit on raspbian/ linux
- Qt with webRTC how to implement
- QWebKit how running js on page from python
- Python3 PyQt5. How can I run the PyQt window method from the main process?
- all webcontent to string
- How to keep current URL updated in QWebKit browser
- PyQt5 listen to javascript event inside QWebView to be used with python
- PyQt QWebkitWidgets not displaying web page when called from command line or object constructor
- QWebView for running javascript (D3) in a desktop application - slow to reload when HTML changes
- QtWebKit support
- QWebpage constructor segmentation fault
- pyqt4 javascript evaluate redirect loadfinished
- PyQt4: take screenshot of web pages using QWebKit
- How do I make QtCreator 4.2.2 include webkit related files
Related Questions in QWEBPAGE
- Different margin top from the second page with first page odoo report
- qt webengine request camera and mic access on mac
- QWebEngine - how to catch execution of any javascripts from C++?
- Hide Reload action in Qt context menu
- all webcontent to string
- Showing content of QCH-File with QWebEngineView
- Cannot find reference self.loadFinished.connect when trying to execute scripts in HTML pages
- get HTML from QWebEnginePage in QWebEngineView using Lamda
- QT 5.5 Disable Web Security
- QWebEngineView modify web content before render
- QWebView not loading after opening pop up window
- pyqt5.6 interceptRequest doesn't work
- QApplication Within A Shared Library Event Loop Issues
- Qt QWebView/QWebPage Windows Authentication
- Qwebkit links with .org do not work
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
It is possible. You will want to use QNetworkAccessManager, QNetworkRequest, and QNetworkReply classes.
Here's an (untested) example, but should get you started with retrieving the mime-type of a page using a HEAD request:
NOTE: If the server does not send back a ContentType header, your QVariant will be invalid. So, before using contentMimeType, make sure you check if it is valid first. Then you can convert to a QString for checking against your list of valid mime-types.
NOTE: QNetworkRequests are asynchronous, so you'll have to implement a signal-slot relationship for getting the value out of the QNetworkReploy. You can also have a look in QxtSignalWaiter for doing it inline.