Search This Blog

Showing posts with label chrome. Show all posts
Showing posts with label chrome. Show all posts

Tuesday, October 8, 2013

How to dynamically inspect and manipulate the content of your loaded page inside chrome browser

The next generation browsers, like Google Chrome, can offer an powerful feature (Chrome DevTools) that allows you to inspect, debug and manipulate any web page element that you browse.

Demonstration and results description
  • Open any web page in your browser
  • Open the Chrome DevTools console tab: Ctrl+Shift+J 
  • In the console type the following code and press Enter
document.body.innerHTML="this is now your new page"
"this is now your new page"
  • Your loaded page within the browser window should be replaced now with our custom string
  • By running different JavaScript code you can change the behavior and content of your page
Now to start exploring this all what you need to know is basic JavaScript knowledge and some understanding of the HTML standard (a good reference can be found here HTML - Living Standard).

References

http://www.whatwg.org/specs/web-apps/current-work/multipage/
https://developers.google.com/chrome-developer-tools/
http://www.w3schools.com/js/js_htmldom_navigation.asp



Thursday, September 26, 2013

How to save browser session in Chrome for offline analysis

There are commercial tools ( a small example list) that help you to save a browser session that it can be view later. Usually you want to do this when you troubleshooting an HTTP issue where the browser is involved.

Below is a combination of free tools that can save and open a browser session.

Capture browsers session
  • To capture and save the the browser session can use Chrome extension called Chrome Developer Tools. After installation
    • You can activate it in your active Chrome browser window with the shortcat: Ctrl+Shift+I. It will open a new panel at the bottom of your screen.  
    • Navigate to the Network tab
    • Now you can browse your site(s) and you should see all the requests your browser does.
    • Once you finish please click with the right mouse button on any of requests and select from the menu "Save as HAR with content" to save an HAR file on the disk.
Open a browser session for offline analysis 
  • You can send a HAR file to any other person for offline analysis.
  • An example application that can read and display it is Fiddler.
  • From Fiddler menu open the HAR file by navigating to File->Import->HTTPArchive
References

http://fiddler2.com/Features/web-session-manipulation
http://neverblog.net/save-and-share-results-from-chromes-developer-tools-network-panel/
http://blog.chromium.org/2011/02/chrome-developer-tools-back-to-basics.html

Thursday, July 4, 2013

How to view and edit cookies in Chrome

When you configuring more complicated scenarios on load balancers it is only a matter of time when you start looking at the HTTP requests and responses because things don't work the way you want.

Problem

Q1: How to view browser cookies when viewing sites?
Q2: How to edit cookies in Chrome?

Analisis and results description

Add Q1:
  • Start the Developer tools in Chrome. 
  • Refresh your page with Control+F5.
  • Navigate to the Resources tab and select Cookies
Add Q2:

The Chrome Developer tools doesn't allow you to edit cookies. You can only view or delete them.
To edit cookie values we can use one of the additional plugins: Edit This Cookie
  • Install "Edit This Cookie" plugin
  • Refresh page with Control+F5
  • Once page loads click the cookie icon on the Chrome  
  • Change the cookie 

Thursday, January 31, 2013

How to modify HTTP Host header in Chrome

HTTP protocol troubleshooting requires sending of GET requests with a preset headers like 'Host' one. You can always do it using curl but you may want to see the result directly in your browser.
$ curl -H "Host: rado.example.com" http://www.google.com/mysite_rado.html

Problem

How to set and change the default Host header when Chrome sent request.

Solution and demonstration

We can use the 'Change HTTP Request Header' extension. It allows us to tamper the default browser headers. The best part is that it works well with HTTP as well as HTTPS base requests.

This is how the extension looks like.

This is how we have to configure it to change the Host header to different value like 'rado.example.com'.
And this is how an original and modified request looks like on Developer tools.

References
  1. https://chrome.google.com/webstore/detail/change-http-request-heade/ppmibgfeefcglejjlpeihfdimbkfbbnm

How to inspect HTTP headers for GET request in Chrome


When troubleshooting HTTP protocol it is required to inspection and verify various HTTP headers for the sending requests and receiving response.


Problem

When in Chrome navigating to http://example.com/mysite.html URL how to see all headers.

Solution and demonstration

There are very few extensions that allow you to inspect the request headers  Most of them give you access to the response data only. The Developer tools is the only one extension I found that shows request and response headers in Chrome.

This is how you can start and test it:

References
  1. https://developers.google.com/chrome-developer-tools/
  2. http://stackoverflow.com/questions/4423061/view-http-headers-in-google-chrome 
  3. http://blog.ashfame.com/2010/05/view-html-headers-firefox-google-chrome/

Sunday, November 18, 2012

How to extract captions from a youtube video

There are videos on youtube that are 30min and longer. You've watched a video and later on you would like to find only a single moment that is interesting for you. With a help of subtitles and key word searching we could easily do it.

Problem

How to download and search in Google text captions file from a youtube video.

Solution

There are couple of solution that can be found on Google in the referece section. All the automatic ways didn't work for me. Below is a manual method that I used to extract the subtitles (caption) file from a Google video.

  • Open a video page in Chrome browser. 
  • Enable debuging and reqeuest trucking by pressing F12 in Chrome.
  • Enable caption in the video. 
  • Navigate into the Network tab and find the last timedtext request (the last at the bottom)
  • Right click on it and open that file in a new tab; An xml file containing subtitles with the imestamps should be opened. 

References
  1. http://mvark.blogspot.in/2012/06/how-to-extract-subtitles-from-youtube.html
  2. http://stackoverflow.com/questions/10036796/how-to-extract-subtitles-from-youtube-videos
  3. http://webapps.stackexchange.com/questions/25072/how-do-i-download-subtitles-from-a-youtube-video
  4. http://www.youtube.com/watch?v=drTyNDRnyxs