Display WebSocket message with formatting? - google-chrome

UPDATE: At time of asking this question, this was related to SignalR library and not plain WebSockets. I see correctly formatted messages now.
Is there any way to word-wrap messages in WS tab in Chrome Developer Tools or display JSON with formatting ? It's really annoying to scroll to right to see whole message.
Example with message selected and it's preview doesn't have any formatting or word wrapping applied:
Thank you in advance.

It's working fine here on Chrome/78.0.3904.97:
What I did:
Go to http://crawl.develz.org/play.htm
Open one of the listed servers
Start devtools
Go to the Application tab and add a cookie called "no-compression" with value "yeah no" to the relevant server. (Any truthy string should work, I just chose the least confusing one I could think of in about a minute.)
Otherwise, crawl's webtiles server can end up compressing messages even when browser supports RFC 7692's "permessage-deflate" extension, which ruins the demonstration.
Open the Network tab
Reload the page
Select the "socket" request, switch to the "Messages" tab, and pick a frame.
Start drilling down in the tree view in the bottom pane!

Related

Can Firefox Inspect Element Network find json strings like Chrome can?

My intention is to analyze json strings as part of REST messages.
In Chrome there are possibilities to use Inspect -> tab Network to find the json string that I want. However I cannot find the json string in Firefox.
Does Firefox support this?
I will show an example from a public page.
Open https://www.theguardian.com/ in Chrome
Inspect (Ctrl-Shift-I) and select tab Network
Click UK (UK News)
On tab Response you will find json strings as for examlple comment-counts.json
like
{"counts":[
{"id":"/p/5kmed","count":269},{"id":"/p/5kkv8","count":39},
{"id":"/p/5kq4t","count":5},{"id":"/p/5k7x7","count":1064},
{"id":"/p/5ky88","count":1720},{"id":"/p/5kp8e","count":841},
{"id":"/p/5kkbv","count":692}]
}"
Image: Inspecting The Guardian UK News
In Firefox I cannot get this piece of code. I have tried Inspect Element tab Network and sub-tabs Headers, Params and Response.
Do anyone know if it is possible in Firefox and in that case how to get it?
Background: I'm working in a corporate linux system where I haven't authority to install so much. However I have access to Firefox 45.5.1 and a bad build of Chrome 43.0.2357.81.
Thanks for any idea you come up with.
AFAIK, Firefox currently offers only a "structured view" of JSON responses in the developer tools.
There is a ticket in Bugzilla requesting plain text view.
Not sure about Firefox 45, but the latest release offers a context menu entry which allows copying response text to clipboard. Maybe that helps.
With Rafael's answer I found out what I needed.
Sometimes Copy Response works fine.
When that does not work I can find what I need from Copy All As HAR, which contains more or less everything before "now".
Since I'm a newbie I can neither flag up Rafaels answer nor flag that this question has been answered.
From my perspective I am fully satisfied and the case can be closed.

What additional data to send in URL request?

Short version: How do I know how to phrase additional data (like specific options on the page that display different html files but belong to the same URL) when getting an URL with urllib?
Long version:
I am having trouble to figure out how to handle properties of an url request that are not determined by the Link URL but by probably other information that your browser is usually sending.
To be more precise:
This page contains a table that i want to read with python, but the length of the table depends on the number of items per page you choose in the bottom left (i.e. the number of items in the code I get from urllib.request.urlopen is the standard of 50 or something, not the complete table). Clicking the buttons for e.g. 400 items per page doesn't change the URL so I expect that there is some information sent somewhere else. I understand that using urllib can send additional data besides the url, but it is unclear to me how to figure out how I should phrase the "give me the whole table" (or "give me 400 items per page") in that data.
Studying the .html file I get from saving the webpage in my browser didn't give me any hints and I miss the vocabulary to search for answers on the web (that is, googling "urllib request parameter" is too vague).
Hence I'd be completely satisfied if someone would point me to a duplicate of this question.
Thanks in advance :)
For everyone else finding this question I'll elaborate on the answer #deceze gave in the comments:
Open the webpage you want to read in your browser
Open your Browsers network panel (in chromium this is [Strg+Shift+I] or right-click > Inspect
Go to the "Network" Tab (at least in chromium)
Do whatever you want your program to do and the empty network panel list will fill with a lot of data
Find your request in the list of events (one of the very first ones is right, I would guess), click it and select "Headers"

Mailto link causes Chrome to crash

I am developing an application for an environment where Chrome Version 29.0.1547.62 is used.
As part of the application, there is a requirement for a mailto: link. When this link is clicked, MS Outlook opens with the provided information in a new message.
In general this works as expected, however the following string causes Chrome (including all other Chrome windows) to crash with a message that begins with 'Whoa!'
> mailto:xxxxxxxxxx#xxxxxxxxxx.xxx?body=xxxxxxx%0A%0Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> %0A%0Axxxxxxxxxxxx x xxxxxxxxxxxxx%0A xxxx%0A xxxx%0A xxxx%0A xxxx%0A
> xxxx%0A%0A xxxxxxx xxx
I have obviously removed all personal information, but the structure is otherwise the same. The issue can be replicated by pasting the link into the omnibox.
Removing one of the x's from the end will cause it to work correctly, making it appear to be a length issue, however simply having a longer body made solely of x's doesn't cause an issue.
My question is:
Has this issue been specifically resolved in a later version of Chrome? If so, then a simple ($.browser.chrome && $.browser.version == 29) check would be sufficient, but if it has not, then I will have more of a problem.
Unfortunately the common fix for adding the GMail handler is not appropriate here, and it is also not possible to add any command line arguments to Chrome on start up, limiting the amount of debug information I can provide.

Can you use HTML5 local storage to send form contents "later"?

Let's say someone is writing a reply to an online forum on their iPhone when they lose connection.
Is it possible to use HTML5 local storage to save their submission and post it when they get connection back?
If so, how do I tell if the phone has a connection or not?
Yes you can by implementing your custom logic into the app.
To see if a connection is available you could either use navigator.onLine flag (but it seems that is not completely reliable):
Does Safari and/or WebKit implement the equivalent of window.navigator.online?
http://html5demos.com/offline
or try to load content from the internet and see if it's possible or not:
Checking online status from an iPhone web app
Could you not use JavaScript to set a variable and make it a string with the content of whatever the user puts in the box? You could use getElementById or similar to get the content from the form.
Then, store it in a "cookie". If you don't know how to do this, here is a quick run down on javascript cookies from w3: http://www.w3schools.com/js/js_cookies.asp
Then on page load you could have it load the cookie and make the value of the form equal to the variable you declared earlier.
The best approach (in the light of navigator.onLine behaving inconsistently in different browsers) would be to save whatever the user is typing to localStorage every few seconds or every few keystrokes.
If the page is reloaded again, then you can make sure to first see if there is anything stored in the localStorage key, and if so, then load that into the text box and the user can continue from where he left off.
You can also take a look at the 'going offline with web storage' section of this article http://dev.opera.com/articles/view/taking-your-web-apps-offline-web-storage-appcache-websql/

IE printing out source code at random (seems very nondeterministic)

Hey. the busted website is: www.mgxvideo.com/mgxcopy-alpha-3, and the specific error that I'm getting is the thing where IE prints out all my source code.
As far as I can tell, the error is appearing at random in IE6, 7, and 8, but it's a commonly occuring error. I'm looking for explanations, debugging tools, fixes. Anything is appreciated, because I'm fully stuck.
Here's how to reproduce:
Add item(s) into cart.
At the display cart (the url shud end with cart_display_ie.php)
Use the shipping calculator over and over and over again until you get the error. It's happened one the first, second, 5th, and the 17th try.
Reset cookies to restart from fresh
Here are some possibly relevant details
1and1 hosting, php from scratch, and mysql
I'm using Mark Sanborn's php code to interface with UPS's servers.
I'm using a local DTD for xhtml transitional 1.0
This error also appears in the checkout cart and also seems associated with the UPS function.
This isn't directly relevant, but IE also plagues me with "The XML page cannot be displayed."
Occassionally, the "The XML page cannot be displayed" is displayed as a small canvas within the context of a source print like the error I'm printing. It'll appear near the location of the error in html source, except the canvas has a really small width and height, and not display any further source code afterwards. I've fixed all these errors; they were all caused by improper syntax or w3 rationing of DTD downloads.
The cart_display*.php is responsible for adding products, removing products, and calculating shipping.
Sometimes it's something stupid like custom settings on my computer b/c I tweak with random settings that cause side effects. But I've tested in msft's VirtualPC, and had friends reproduce the error.
Here are some resources of similar problems. I haven't tried them because--even if they work--they mean that the website doesn't work at typical/default settings.
http://www.techsupportforum.com/microsoft-support/internet-explorer-forum/168285-ie7-problem-printing-html-xml-source-rendering.html
http://www.computing.net/answers/windows-xp/ie6-printing-problem/160128.html
Like I said: any explanations, tools, guesses, or fixes are fully appreciated. I'm trying to finalize the site so I can present it as a beta within the week, and I'm fully stuck. Also, is there a workaround (like a tag) that can hide this error from the user?
I grabbed a network capture of the repro using Fiddler (www.fiddler2.com).
It looks like you're sending an HTML comment containing a webservice result before the HTML body. It further looks like IE is subsequently sniffing this as an XML body instead of a HTML response.
It appears that if you move your HTML comment inside your HTML tag, the problem goes away.
Note that you should confirm changes in a new browser tab. Once IE is on an XML page, simply hitting F5/Refresh isn't necessarily going to show you the HTML content properly due to caching of the MIME-type decision.
To resolve this issue, you need to re-register two dlls.
Open a elevated command prompt and type following commands
regsvr32 /i mshtml.dll
regsvr32 /i shdocvw.dll
For detailed fix steps, visit http://geekzsupport.com/internet-explorer-prints-html-source-code/