I'm creating a firefox extension and I want to get the HTML page elements
using javascript but the document.getElementsByTagName('*') is always giving me an xul objects array.
How can I get the HTML objects array ?
If you want to access the current tab's content from an extension then you need to use content.document.getElementsByTagName('*') etc.
Related
I'm trying to retrieve text that is loaded dynamically from a web page using golang.
The text to retrieve is on this page :
https://www.protectedtext.com/testretrieve?1234
This text is encrypted by a password and then decrypted on client side and loaded dynamically on the page.
I already tried with goquery by selecting 'textarea' object, but I can't get the text cause it's loaded dynamically.
How can I achieve this ? By executing JS in Go ? It's working in my chrome console, but no ideas on how to do that in Go.
A lightweight solution is the best for my project. Or any other website that can store and edit same text without modifying the URL ?
You may need a headless browser to load the javascript like for example phantomgo
However looking at the page source code we can see that they use sha512 for the tab title and aes for the textarea field.
The page which you shared contains https://www.protectedtext.com/testretrieve?1234, only one element of class textarea-contents
simple get class documents using goquery and get 0th part
I'm trying to use TinyMce in a webviewer in FileMaker but save the resulting HTML into a database field.
I am aware of the standard practice of using an fmp:// link with a script & parameter, but that won't work in Windows (the html content returned as the parameter will likely exceed the 2048 character limit).
I am using a javascript function to change the HTML DOM, putting the contents of the TinyMCE editor into another div on the page. However, when I use GetLayoutObjectAttribute ( "webviewer" ; "Content" ) it shows the content of the unmodified (pre-javascript altered) page, not the page after javascript has modified the DOM.
Sample file: http://cris.lc/sxti2
Is this expected behavior? Am I doing something incorrectly?
This is the expected behavior on FileMaker Pro and FileMaker WebDirect.
FileMaker Go is different. GetLayoutObjectAttribute ( "webviewer" ; "Content" ) DOES get the current DOM with FileMaker Go.
if a whole bunch of elements gets generated in my browser by javascript (using JSON data or just out of thin air) I am not able to fully archive such a page by saving its source. I already tried saving it as .mht file in IE, but that does not work - IE does not save the dynamically generated elements either.
An example of such a page is here http://www.amazon.com/gp/bestsellers/wireless/ref=zg_bs_nav - notice that "price" and "X new" elements do not exist in the source html but rather are dynamically generated.
If I wanted to parse this, I could work directly with the DOM by various means, yadda-yadda. But if I want to automagically save the page as html document such that it could be rendered with all the dynamically generated elements nicely rendered even while javascript is turned off, so far I am SOL.
Any suggestions?
In Firefox there's the Web Developer extension: https://addons.mozilla.org/en-US/firefox/addon/web-developer/
Once installed you can use View Source -> View Generated Source to access the JavaScript-modified HTML.
<address>111 North Bridge Road </address>
Hi,
I have a XML file with many tags like the above.
I'm using javascript that read the file and use document.write to write contents of the element.
However everytime it reads an empty element, it stops writing .
Is there anyway to check for an empty element using javascript?
An empty element doesn't have childNodes, so you could check
element.childNodes.length
I am using "node.attributes" to retrieve all the attributes of a DOM node using JavaScript in IE.
It gives me additional attributes which are not specified in the source .In Firefox it gives only those which are specified in html source (which is expected).
is there any way to retrieve "only the attributes" of a DOM elements which are specified in its HTML source in IE?
Thanks in advance.
-Sourabh
The attributes have a specified property which is true if the attribute was specified in the HTML source or explicitly set by script.