Javascript Frame Target | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Javascript Frame Target

Hello I have minimal experience in JavaScript and decided to make a bookmark that fills in a form on a website and submit(). I am using the console on the Internet Explorer Developer Tools to test my code. On the website I want to run my commands there is a complication. I can run commands on the website via Developer Tools, only after I change the Target: "_top: New" to Target: "Frame: UIService.aspx" in my Developer Tools Console. My JavaScript codes saved as bookmarks don't work because they are targeting the wrong frame. How do I change the frame from Target: "_top: New" to Target: "Frame: UIService.aspx" in code? They have two different URLs.

24th Oct 2019, 10:30 AM
Branam
Branam - avatar
2 Answers
+ 1
document.querySelector('Your_ID_Iframe').contentWindow.document This is right? ref: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_element_iframe
25th Oct 2019, 6:32 PM
Jônatas Araripe
Jônatas Araripe - avatar
0
I tried with no success, these are the outputs: document.querySelector(' iframe class name ').contentWindow.document Unable to get property 'contentWindow' of undefined or null reference However this returns true: serv = document.getElementsByClassName(' iframe class name ') serv.length: 1 I need to alter a table inside of this iframe, so I would do: serv.getElementById(' id of table '); ?? This is not correct?
4th Nov 2019, 11:03 AM
Branam
Branam - avatar