Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome -> Inspect element -> Network (XHR) -> Preview Tab (HTML) issue

I am having a problem with that preview tab in network section. When HTML is returned I am seeing the raw HTML in both preview and response. Sometimes, but very rarely, I HTML is rendered properly in Preview tab.

Am I doing something wrong or it's just some Chrome bug?

Thanks

like image 365
Mladen Janjetovic Avatar asked May 17 '12 09:05

Mladen Janjetovic


People also ask

How to Inspect Element in the Chrome browser?

Listed below are the steps to inspect element in the Chrome browser: Launch Chrome and navigate to the desired web page that needs to be inspected. (Let’s consider BrowerStack’s home page in this example)

What is element panel in chrome?

Getting to Know the Element Panel in Chrome Element panel is a feature in the chrome developer tools that allows you to inspect and modify a site from the front-end. It’s used to change the appearance and content of a web page by editing its CSS and HTML files.

How to inspect a web page in Chrome using browerstack?

Launch Chrome and navigate to the desired web page that needs to be inspected. (Let’s consider BrowerStack’s home page in this example) From the drop-down menu, click on More tools -> Developer Tools macOS users can use the shortcut – command + option + C and Windows users can use Control + Shift + C.

How to hide an element in Google Chrome using CSS?

Open Google Chrome and go to a website. Here, we use hostinger.com. Right-click on any part of the web page and select Inspect. Enable the Inspect feature and click on the element you want to hide. Right-click on the code highlighted on the DOM tree and select Hide Element. A new visibility property will appear on the CSS panel.


2 Answers

I was testing this as well. What did it for me was adding the http header.

header('HTTP/1.1 500 Internal Server Error');

Then of course some proper markup formatting. But the status code was what I needed to convince chrome to render the preview.

like image 185
Dustin Graham Avatar answered Oct 08 '22 14:10

Dustin Graham


Problem is solved when you add a proper Content-Type header. If its text-html then it will display content like it would be normal text no matter what do you send from server. I had the same problem and solved it by force'ing output type in $.ajax options. When i changed it to application/json and its nicely formatted now.

like image 39
lukasz Avatar answered Oct 08 '22 13:10

lukasz