View Json Result in Web browser - json

I tried to view the Json result from HTTP Response in browser through C-sharp code but crushing my head didn't get it.So, whether we can have an option to view all HTTP Response results in the browser?

If you want see JSON result on your browser,
Use : https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en (JSONView for chrome)
OR
https://addons.mozilla.org/en-us/firefox/addon/jsonview/ (JSONView for Firefox)
and simply use url parameters to see JSON response in your application : http://localhost/westwindwebtoolkitweb/RestService.ashx?Method=ReturnObject&format=json&Name1=Rick&Name2=John&date=12/30/2010

Related

How to change name of the http request in chrome? (using node)

Is there a way to change the name(nombre) of the http request in chrome?
The names that are currently showing are the parameters that I send to the get request.
I'm using Node and angular
You can check the 'Use large request rows' checkbox in the main screen of Chrome DevTools to display the rest of each URL underneath the final segment that is shown by default

(Swift) How to present HTML in WebView

When I try to load url everything works fine. I also tried to load normal HTML and that worked fine too.
But this html I got from API is so weird and without tags. Is it possible to somehow present this in webView?
This is how my HTML looks like:
Code to load it :
var html: String
html = cards[Int(slider.value)-1].content
print(html)
webView.loadHTMLString(html, baseURL: nil)
The API is returning the data URL-encoded. So you have two options:
Preferred: Try fetching the data non URL-encoded. Maybe by passing the accept header "text/html", assuming the API might default to "text/plain". Check the API documentation and your request headers.
As a fallback: Use NSString.removingPercentEncoding.

How to see final html when http requesting

I call a http request to get the html of a url. The same also happens, for example, when doing "view source" in Firefox. As you know, the html is different than the final html of the site as it is seen in the browser itself.
Is there a way to call the http request of a url and "do something" so I will have the final "version" of the html including everything that is there when the site ends to load?
The Firefox was an example, I meant calling a http request with a http client, using Java for example. I call a http request to get the html but the html is the "before" state.
Thanks

Google Chrome show ajax response

I am using Google Chrome Developer Tools to try to see the response of some AJAX url's.
The problem is that when I click on the NETWORK TAB, then on the link, then on RESPONSE, I see this text : "THIS REQUEST HAS NO RESPONSE DATA AVAILABLE".
I have been using FIREBUG and I am 100% sure there is a response from that page.
Can somebody help with this ?
Thank you !
You can try manually checking if there's a response or not
So, generally when dealing with ajax, in most cases we use the POST, You can create a 'same structured' page to handle same input/response but using Get method and print the output data as normal.
This way you can see if there's any response/errors in your script very easily

Chrome extension, replace HTML in response code before browser displays it

i wonder if there is some way to do something like that:
If im on a specific site i want that some of javascript files to be loaded directly from my computer (f.e. file:///c:/test.js), not from the server.
For that i was thinking if there is a possibility to make an extension which could change HTML code in a response which browser gets right before displaying it. So whole process should look like that:
request is made
browser gets response from server
#response is changed# - this is the part when extension comes in
browser parse changed response and display page with that new response.
It doesnt even have to be a Chrome extension anyway. It should just do the job described above. It can block original file and serve another one (DNS/proxy?) or filter whole HTTP traffic in my computer and replace specific code to another one of matched response.
You can use the WebRequest API to achieve that. For example, you can add a onBeforeRequest listener and redirect some requests:
chrome.webRequest.onBeforeRequest.addListener(function(details)
{
var responseData = "<div>Some text</div>"
return {redirectUrl: "data:text/html," + encodeURIComponent(responseData)};
}, {urls: ["https://www.google.com/"]}, ["blocking"]);
This will display a <div> element with the text "some text" instead of the Google homepage. Note that you can only redirect to URLs that the web server itself is allowed to redirect to. This means that redirecting to file:/// URLs is not possible, and you can only redirect to files inside your extension if these are web accessible. data: and http: URLs work fine however.
In Windows you can use the Proxomitron (proxomitron.info) which is a local proxy that can intercept any page or file being loading into your browser and change it using regular expressions (no DOM parsing) however you want, before it is rendered by the browser.