My goal is to change a value from a to d inside the array options in menu.html using Greasemonkey extension in Firefox but my problem is that the element I am trying to select/access is loaded as a frame.
I have been trying to solve this issue for some time now and I would be very happy if someone could help me out.
I have got two files main.html and menu.html whose contents are:
main.html (is the main page)
<html><head><meta http-equiv="Pragma" content="no-cache"><script language="javascript"> document.writeln("<frameset rows='89,*,15' border='0' frameborder='0' framespacing='0'>"); // here is the menu frame document.writeln("<frame src='menu.html' name='menufrm' frameborder='no' border='0' scrolling='no' target='_self' marginwidth='0' marginheight='0' noresize>"); document.writeln("</frameset>");</script></head></html>menu.html (is loaded "through" a frame)
<html><head><meta http-equiv='Pragma' content='no-cache'><link rel=stylesheet href='stylemain.css' type='text/css'><script language='javascript' src='menuBcm.js'></script><base target="_self"></head><body class='mainMenuBody' topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"><table border="0" cellpadding="0" cellspacing="0" height="1000"><tr><td class='menu' width="170" valign="top" align="left"><script language='javascript'> var options = new Array('a','b','c'); // ultimate goal is to change the value of a to d above before // execution of the script below createBcmMenu(options); // from menuBcm.js initializeDocument();</script></td></tr></table></body></html>Which looks something like this:
+----------------------------+| main page (192.168.1.1) | | | | +---------------------+ | | | frame (192.168.1.1) | | | +---------------------+ | | | +----------------------------+Greasemonkey script:
// ==UserScript==// @name a-to-d// @namespace namespace// @include http://192.168.1.1/main.html// @include http://192.168.1.1/menu.html// @version 1// @grant none// @run-at document-start// ==/UserScript==var newScript = `var options = new Array('d','b','c');` ;// somehow select that element belowdocument.(!).innerHTML = newScript; // (!): somehow select script element in menu.html