'Get value from another #document JavaScript !Doctype
How can I get value from another iframe?
When I inspecting the website and I click on this line:
<input type="hidden" name="1" value="q"›
And I type this to the console:
document.getElementsByName("3")[0].value
I can get the value:
'e'
But if I click outside from iframe, and I check the value I get this result: VM89205:1 Uncaught TypeError: Cannot read properties of undefined (reading 'value') at :1:49
Looks like I have to click inside if I want get the value. Is it possible to get the value without every time click inside?
<iframe name="frame" id="frame" src="TEST.html?token=asdasdasd" style="display: none;"> ==$0
#document
<html>...</html>
</iframe>
<form name="apple" id="apple" method="get" action="test.htm?token=asdasdasd" target="dialog"> <input type="hidden" name="1" value="q"›
<input type="hidden" name="1" value="q"›
<input type="hidden" name="2" value="wm>
<input type="hidden" name="3" value="e">
<input type="hidden" name="4" value="r"›
<input type="hidden" name="5" value="e>
<input type="hidden" name="6" value="z">
<input type="hidden" name="7" value>
<input type="hidden" name="8" value="u">
<input type="hidden" name="9" value="i">
<input type="hidden" name="10" value>
Solution 1:[1]
Add name tag
<input type="hidden" name="1" name="q" value="q"›
and then type this to get the value
var v = document.getElementById("q").innerHTML;
console.log(v);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | manhat |
