I'm using Scriptish to check when certain responses occur when loading a web page and redirect to another web page. As I need to have the referrer field set, I do this by having a user script add a link to the page and then create and dispatch a MouseEvents to click on it. That used to work until recently, when now it does nothing unless I allow scripts on the web page page (it's not a known set of pages so that's not possible).
Is there a way to have NoScript not block "click" events initiated from Scriptish?
Here's the code in my user script:
Code: Select all
// since referrer is not set by setting href in Firefox 4 and up, we need to create a link and "click" it.
var location = document.location.href.toLowerCase();
var newLink = document.createElement('a');
newLink.setAttribute('onclick', 'document.location.href = "' + location + '"');
document.body.appendChild(newLink);
var evt = document.createEvent("MouseEvents");
evt.initUIEvent("click", false, false, window, 1);
newLink.dispatchEvent(evt);
As far as I can tell, everything works up till the last line. That line processes (i.e. doesn't generate an error and returns true), but nothing happens.