im simply trying to create a surrogate script that will essentially overwrite function "test" after the page loads:
- Code: Select all
user_pref("noscript.surrogate.test.replacement", "window.test=function(){alert('changed')}");
user_pref("noscript.surrogate.test.sources", "^file://*");
the file on my desktop has this in it:
- Code: Select all
<script>
function test() { alert("original") }
</script>
<button onclick=test()>test</button>
the expected outcome is that once i click the button, i'll see an alert that says "changed". this doesnt happen; it says "original".
this should work because my javascript logic is correct:
- Code: Select all
<script>
function test() { alert("original") }
window.test = function() {alert('changed')} // what the surrogate should pretty much be doing
</script>
<button onclick=test()>test</button>
<!-- alerts "changed" -->
after some testing, i found something more troubling; this EVEN SIMPLER syntax does NOT WORK:
- Code: Select all
user_pref("noscript.surrogate.test.replacement", "alert('test')");
user_pref("noscript.surrogate.test.sources", "^file://*");
what am i missing?????? note, i do not want to run my surrogate BEFORE the page loads via the use of the "@" sign as noted here



