restrict QLabel Internet assess
Hi. Any one know how to prevent QLabel dig into internet when loading html? We load small compatible with QLabel html files. But if user by mistake try to load file saved from internet, it take very long time, and program begin lagging. But when internet assess is disabled - any file loading quickly with no lag.
Is it possible to restrict QLabel loading external links in html?
Re: restrict QLabel Internet assess
You could connect to signal linkActivated(), and do the internet available check and do required stuff.
Re: restrict QLabel Internet assess
Quote:
Originally Posted by
Santosh Reddy
You could connect to signal linkActivated(), and do the internet available check and do required stuff.
Hi, thanks for your answer, but how "link user interaction signal" related to my question? I need to prevent internal QLabel internet access, while it loading initial html file - before user see any text on screen.
Re: restrict QLabel Internet assess
You can (should always) sanitise the user input before giving it to QLabel. The simplest approach might be to start with: If the text provided contains "http://" or "https://" then reject it. If you need to load local resources from an intranet then: If the text provided contains "http://site/" or "https://site/" where site is not one of yours then reject it.
Re: restrict QLabel Internet assess
Thank you, I came to about the same decision. But sadly, "http://" or "https://" can occur in comment sections, for example:
Quote:
<!--HTML generated by ..., http://...-->
So it's not the simple regexp search...
Re: restrict QLabel Internet assess
In <a> or <img> elements the URLs will be href="..." or src="http://..." so look for the attribute name as well would help.