CSP preventing user script on Wanikani Community page

I just found out about Tampermonkey a few hours ago and have tried to play around with it. It seems cool and I have the extension running a few premade scripts. However when I try to run a very simple script of my own:

// ==UserScript==
// @name         Alert Page Title
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://community.wanikani.com
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    var title = document.getElementsByTagName("title")[0].innerHTML;
    alert(title);
    console.log(title);
})();

just to test it out the script doesn’t run. It works fine when I try it on Chrome but doesn’t seem to run on Safari. Tampermonkey recognizes that the extension’s compatible page has been loaded with the ⓵ appearing on its icon so the URL regex is fine.

This seems like a really stupid question I know but after a few hours of Googling I can’t seem to find anything about this. I’m running MacOS 10.15.1 with Safari 13.0.3; the version of Tampermonkey I’m using is the one installed from the MacOS App Store.

It was noted that the @run-at line might cause errors so I removed it. Also I have include the console logs for both Chrome and Safari.

Changing the page of execution to the Wanikani dashboard works and no errors occur. I have also noted that other user scripts that were made to enhance the forums will also invoke the CSP error. Is this a known issue and if there is a solution how can I find it?

Thanks!

My main goal is to add a “Back to Dashboard” button to the top of the forum page.

1 Like

If it helps, this script includes a link to the dashboard already:

1 Like

Thanks for showing me this. It looks really cool! But, I wanted to write a script just for the practice and such, and unfortunately it also doesn’t seem to want to work. It throws the same error that I get with my dummy run.

1 Like