I have an array that looks something like this in the file menu.html on the local address http://127.0.0.1/menu.html :
<script language='javascript'>
<!-- hide
var options = new Array('blue',
'a',
'm',
'1',
'1',
'0',
'1'
);
// change value of blue to green before execution of the function below.
createMenu(options);
// done hiding -->
</script>
I want to change the value of blue to green before createMenu(options) is executed using greasemonkey.
I tried to create the a new user script that includes http://127.0.0.1/*
with the contents
// ==UserScript==
// @name scriptname
// @namespace namespace
// @description makes password blue
// @include http://127.0.0.1/*
// @version 1
// @grant none
// ==/UserScript==
unsafeWindow.options = new Array('green',
'a',
'm',
'1',
'1',
'0',
'1'
);
But this code does not work as intended.
Does anyone know how the value can be changed in the array options from blue to green?
I am using unsafeWindow since I am not concerned about the security for this user script.