QWebView shows raw html in some cases - html

I'm using the following code.
QWebView *lpView = new QWebView(*%parent_widget%*);
lpView->load(QUrl(*%path_to_html%*));
With some pages it works just fine and shows the rendered page. And on others it shows raw html.
I suspect that the issue is the content of html page but I can't pinpoint what exactly breaks the rendering in QWebView.

The problem was with encoding. Pages that didn't load were in UTF-8 with BOM and QWebViewer expected plain UTF-8.

Related

Including an XML file (transformed with XSLT) in the content area of my HTML

I have the following simple problem: I have some data in an XML file that i want to display in the content area of my HTML page. I also have a stylesheet (.xsl) for my XML file. When I open the XML in my browser it looks exactly what i want it to look like. However, i don't know how to embed the transformed xml (which is xhtml) in my existing HTML page. What I have so far is:
Movie List
Of course this Code just creates a link to a new page, where only the xml is displayed, instead of including the whole thing in my html...
Is there any elegant solution for this? IFrames come to my mind but i'd like to avoid them because they are so horribly outdated.
Thanks in advance.

Instagram embeds render HTML in caption

It seems today the captions on instagram embeds have started to output HTML instead of the rendered text.
See here: https://www.qthotelsandresorts.com/melbourne/qt-blog/viktor-rolf-fashion-artists/
I noticed this also happens on Instagram's own website
https://www.instagram.com/developer/embedding/
Is there anything wrong with Instagrams code at the moment?
Looks like a temporary issue with html entities being encoded, it's fixed now.

Document header not evaluated below ie10

I have a Wordpress site and created a custom theme for it. The pure CSS and HTML test version (without making it an actual Wordpress theme) is displayed 100% correct.
As soon as I make it dynamic and create a WP theme, IE 10 is ok, but IE10 compatibility and below somehow evaluate my document head as part of the body. It is displayed in IE html view window like this:
'!!!' is my actual title. All the CSS and meta information should be before my title, and somehow the head ending metatag is not displayed but it is present in my html markup.
SourceCode view is displayed as:
Head ending and everything in place. However there are two leading whitespace before DOCTYPE declaration, I have no idea how they got there, cleaned up every possible place in my source files. If I copy and paste their value into notepad two question marks "??" are displayed instead of whitespace.
Have never seen anything like this before. Mozilla and Chrome are 100% ok.
In case anybody has the same problem I found the answer.
My page.php and functions.php file of the Wordpress theme was utf-8 encoded that sometimes puts leading whitespace in the source code. This was enough for IE. I made it ANSI encoded and now it is ok.

.html file without any HTML tags

Beginner question:
Every .html page we create requires tags to start and end html file an recognize it as a html file.
But even when I don't give any HTML tags and simply write a text in .html file, the file gets opened in the browser with the text I have written in the .html file without using any of the HTML tags.
How is the text getting displayed in the browser without using any HTML tags?
Does the browser automatically add HTML tags behind the scenes??
When I viewed the page source in that also it shows simply the text not the HTML tags...
This is a very simple question but driving me nuts please help me
Yes the browser automatically add HTML tags behind the scenes:
look:
My HTML file:
In my browser (F12 in chrome to get this OR CTRL+U to get the source code):
Yes, if you don't supply any tags, the browser will add some default tags. It knows it's HTML because the server sends the header
Content-type: text/html
If you open the Developer Tools (usually with F12) you can view the synthesized DOM and see the tags that the browser added automatically.
Browsers aren't just software which renders perfect (X)HTML.
They do quite different and often more complicated jobs like:
Fixing malformed HTML
Adding missing tags
If you want to know which HTML structure gets rendered by the browser, take a look at the developer console.
Additionally, the file extensions .html or .htm do not matter. The MIME type which gets sent by the server determines the render mode.
This is why you could create an URI route http://example.com/test.gif which renders as a normal HTML page.
Only if the server (e.g. when accessing from your hard drive) does not provide a MIME type, the browser may try its Content sniffing algorithms.
Because of the .html extension the browser automatically knows that it is HTML, meaning you don't need the HTML tags (however, this is bad practice)...
As for the text being displayed, that is because the text does not need to be inside any special tags in order for it to be shown.
I hope this helps you a bit, let me know if you need further help!
I do not know whether the question is still current, but one solution is to open the HTML document in MS Word. In this case you see only the formatted content.

Html tags are mixing up

I am new to html. I am trying to attached multiple html page on the server (in the memory) and send it back as one page to client (asp.net mvc 3) but my html source tags are mixing up with each other (resulting into wrong layout) if one of my html source content has not closed the tags properly and does something funny with its layout.
How can I do this such that each html content is displayed independent from other html contents one after each other?
EDIT: I should have mentioned that I have no control over the source html content that I need to attach together so it the source html is wrong, it will come to me wrong!
Short of having separate documents, fetched by separate HTTP requests all viewed in (i)frames — you can't.
Write code that doesn't output invalid HTML instead.
I am also new to html and have dealt with this kind of problem simply by changing my code editor. Try using one that highlights the start and the end of the html tag. Personally I use Komodo IDE or Notepad++.