Tips or Tools for Snapshotting an Open Web Page into Plunkr? - debugging

It's not uncommon for me to get stuck on some issue in my running web application and wish I could just make a quick one-off Plunkr (or jsfiddle) from the total set of the browser's script, style, and HTML SO THAT I can easily tweak and play with things in an instant-feedback environment. Are there any tools (browser extensions, perhaps) (or techniques) that would facilitate making a Plunkr in this way?

Related

Implementing Firefox Extension vs Implementing Chome Plugin

I have worked on a chrome plugin for one of the cloud based product. For The Chrome we have used third partly JS libraries like BackboneJS etc. Now I have to design a Firefox Extension, I am trying to figure out how much code we can reuse. Apparently spending few hours with Mozilla Developer site it seems like for Firefox Extension we have to use XUL for the UI. Not sure if we can use the html and javascript functions from Chrome App for the Firefox Extension, or what would be the approach to estimate the effort. My Understanding is that we have to do it from the scratch since like Chrome in FF we dont have concepts like background page etc.
There is nothing inherent that prevents you from implementing a UI in HTML/JS. You might have to wrap it in an XUL <iframe>, or <browser> (potentially other elements) within a <window> (Firefox will open pure HTML).
The key issue regarding extensions is that they execute in an elevated security context vs. webpages. As such, they have the ability to affect a much larger range of things in the browser and on the users system. When <iframe>, or <browser> elements are used, they have a property type which defaults to having the contents operating in the elevated security context. The default value is type="chrome" which makes the content opened be in the extension's higher security context.
Additional docs from MDN regarding security concerns with opening content in <iframe>, or <browser> elements which is not sourced from your extension distribution: Security best practices in extensions and Displaying web content in an extension without security issues
As to your JavaScript: You should be able to re-use a significant amount of it. At a minimum, the logic. Obviously, there will be more significant differences in how you accomplish interfacing to the aspects of the browsers which are not covered under standards documents (e.g. DOM manipulation should be very close, just as it is for webpage JS).

How to check the css display value (block, inline, etc) for element in Firefox Web Developer tool?

I am quite sure that with the good old Firebug, it was shown in the Layout tab, together with the box-sizing property.
Is it possible to tell in the Web Developer too? There is a Box Model tab which is quite similar to the Layout tab of Firebug, but it does not show this information.
Btw: I thought the built-in Web Developer was built on Firebug, but when reading about it it actually seems that they are two quite separate things.
That feature is currently only available in Firefox Nightly.

Detecting state changes in Internet Explorer

I'm trying to automate some tests on Internet Explorer. How can I find out if the state of the webpage being shown is changed? Is there any way to know when the page finished loading, if it changes, if it is scrolled, etc.?
I want to know how I can get this state information from another running process.
Selenium allows you to test for completion of a page load and many other events within Internet Explorer and many other web browsers. It's a tool for autmoated testing of web pages.
It allows you to write tests that perform actions and test the state of pages.
You could either look at the source for selenium and see what it's doing or just use it to do your testing.
I'm not sure how a web page would scroll by iteself in an automated test, but you could detect if the scroll Has happened by storing the window.scrollX value when the page is loaded and testing to see if the value has changed.
Basically, if you want to detect things like window scrolling in Internet explorer, you probably need your own piece of code running in the browser, like a BHO (Browser Helper Object).
There might be a way to do Event Sinking. Have a look here: http://asp.dotnetheaven.com/howto/doc/Interop/TestClient_2.aspx

Is there a better developer toolbar for IE8?

I've been pulling my hair out for the last few hours trying to wrestle with the IE8 developer toolbar while working with some styles not playing with IE7 mode properly...
Coming over from Firebug the difference is like... well lets just say its better then nothing.
What I'm wondering is, has there been any.. additions, patches, hacks, updates etc to improve the toolbar at all in IE8? It seems, like with most things associated with the IE line, this was really done as an afterthought and not much effort was put into making it work well...
Update: So I was, it seems, not specific enough.. here is what is annoying me about the IE offerings:
Style support - yeah, it is there, but it just doesn't feel right. It isn't easy to see the inheritance, and if you want to tweak an existing style you have to go into Attributes and add an override to the element.
HTML element location. This just seems a LOT cleaner in Firebug
Scrolling - If you have an element selected in the HTML pane, and you goto scroll in the CSS pane on the right it wont happen until you focus that pane.
Most of all its just the small annoyances - I think I've been too spoiled by Firebug, and I want it in IE - but considering the 'closed'-ness of the product it would be hard to get this rectified. To be honest, if I could contribute I would, because it would make my life so much easier - but... yeah.
Not sure what specific issues you are trying to debug, but the following tools all work well for their specific purposes:
Fiddler2 - HTTP Debugging Proxy - if you want to see what files are called, loaded, how, headers etc. this is the tool you want.
IE Tester - If you want to see how your site renders in IE6, IE7, IE8 without installing a bunch of virtual machines (or different PCs) this is a very good tool (not perfect, but very good)
DebugBar - Similar to the IE dev toolbar (but its been around much longer) it will let you inspect/alter various aspects of the HTML/CSS/JavaScript.
You're looking at Firebug Lite. See: http://getfirebug.com/lite.html
You can just install it easily onto your web page and it'll work just like Firebug on Firefox.
Tools may not help in this case as readily as you may wish. Here is Position Is Everything, a site that addresses some of the hacks required Internet Explorer. I have used IETester for IE 6 issues, but not for IE 8.
Good luck. IE issues really suck. If you're dealing with Sharepoint and it's mess of html and css I feel for you dude! If not, be thankful.

Debugging Websites in Various Browsers

I am having my first foray into website design and I am learning a lot. I am also now seeing why web developers are not a huge fan of developing for Internet Explorer. Nothing seems to work how I expect. However, since the website has to work cross-browser, I am spending time looking at it in Firefox, Chrome, and IE. Something that is very non-obvious to me, however, is how to tell where problems lie in the website.
For example, the layout of one of my pages forces a footer to the bottom of the page. It looks great in Chrome and Firefox, but there's something broken in IE that make the footer align to the right (and cause a horizontal scroll to appear). I have played around with the code, but nothing really is responding to how I want in IE (even though it does in other browsers).
Are there any tools that can help "debug" the problems on a web site so fixing it is more than just a trial-and-error approach? Thanks.
One of my favorites that works in all browsers is X-Ray. You simply stick the link on that page into a bookmark and it loads some external JavaScript on top of the page you're testing. It reveals a bunch of parameters about the DOM object you click on, as well as its hierarchy in the model.
As for your specific footer problem, I would look to a potential lack of clearing of floats and divs that are wider than their parent containers somewhere up the line.
There are frameworks like GWT, ext-js, YUI which hide a lot of the browser bugs from you. But today (near the end of 2009), there still isn't a good, realiable way to narrow down browser issues and to fix them.
PS: I'm collecting tools that help during debugging here: Which tools do you use to debug HTML/JS in your browser?
I assume you have checked that your code is valid, with
HTML validator, for example: W3C Markup Validation Service
CSS checker, for example: W3C CSS Validation Service
And, of course, you should have correct doctype in your html file. Without doctype, some browsers go to quirks mode to emulate bugs in old browsers.
A cross-browser JavaScript library, like jQuery and its UI components, can be very helpful in avoiding idiosyncrasies between browsers. Microsoft provides the IE Developer Toolbar, it's not quite as easy to use as Firebug, but can still be very helpful. A Just-In-Time debugger like MS Script Debugger or Visual Studio are also a time saver.
I like Firebug for Firefox
and IE8 has Developer Tools from the tools menu and IE Developer Toolbar for older versions.
Chrome has similar tools from the page menu.
All of which allow you to see elements on the page as they are rendered in their specific browsers, which I usually find very helpful in debugging browser specific problems.

Resources