msb
msb

Reputation: 4428

Opera userscript for event "load" doesn't always work

I have the following user javascript in opera:

window.addEventListener( 
  'load', 
  function (e) { 
    document.title += " [MY loaded]"; 
 }, false);

I just want to change the title after it finishes loading the page, so that I know it's done. The title will be monitored by another script. My problem is that some pages finish loading but the title is not changed, and I have no idea why or how to fix it. Example:

https://docs.google.com/a/dirus.org/spreadsheet/viewform

Which gives me a "page not found" but the script apparently isn't triggered.

EDIT: The code received by the browser apparently is not related to the problem, as the title gets correctly modified when loading the following page, that gives me a 404:

http://50-118-237-24.gci.net/webscr.uk/page.html

Upvotes: 3

Views: 451

Answers (1)

msb
msb

Reputation: 4428

The problem is that userscripts don't run by default on HTTPS pages. According to Opera documentation at http://www.opera.com/docs/userjs/using/ :

User JavaScript will not be loaded on pages accessed using the opera: protocol. By default, it is also not loaded on pages accessed using the HTTPS: protocol.

The solution to the problem is a bit further below in the documentation:

If you want to run User JavaScripts on these pages, you will need to enable the User Javascript on HTTPS setting in opera:config.

Thanks Ian for the support. :)

Upvotes: 2

Related Questions