Can this be done? How?
I want to write my own extension. Can Get the current page sorcecode in my own extension?
Can this be done? How?
I want to write my own extension. Can Get the current page sorcecode in my own extension?
Sure, just add view-source: in front of the URL.
view-source:http://stackoverflow.com/posts/edit/145419
Will show the source of this page for instance - try it in the address bar.
As Rich says, adding view-source
in front of the URL will give you the current page's source code. A keyboard shortcut for this is Ctrl+U
.
I want to write my own extension.
There are a number of existing Firefox extensions that fetch a page's source code and apply some action to it (colour-coding, syntax-checking, etc). Downloading them and looking at how they handle it may be a good place to start!
If you're new to Firefox extension development, this article at Lifehacker is an excellent primer in how to start, and will give you an idea of where to look in the above linked extensions for tasks that may be similar to your own.