userscripts icon indicating copy to clipboard operation
userscripts copied to clipboard

Not working on my iPhone 6s+

Open Githubmaniak opened this issue 2 years ago • 9 comments

System Information:

macOS or iOS version: 15.6 Userscripts version: 1.2.2 (27) Safari version: 15.6 Mobile Is this issue related to script injection? Yes Did the test script (pasted above) successfully run on your machine? No

I added a script like Namulink.user.js but it doesn't work. It doesn't seem to work on my iPhone 6s+.

Githubmaniak avatar Aug 25 '22 10:08 Githubmaniak

Did the test script (pasted above) successfully run on your machine? No

The test script didn't work?

quoid avatar Aug 25 '22 12:08 quoid

@quoid Adding any scripts, including test scripts, doesn't work. For example, namulink.user.js removes the PoweLink ad from namu.wiki, but it doesn't work either.

Githubmaniak avatar Aug 25 '22 13:08 Githubmaniak

@Githubmaniak

Thanks for the reply. Let's focus on the test script for now.

What exactly doesn't work with it?

  • can you see the extension popup/menu?
  • does the test script show there?
  • does it not execute?

Any more details and screenshots would be helpful.

Thanks.

quoid avatar Aug 26 '22 02:08 quoid

@quoid 71F577F7-A82B-4C2E-A4BA-F2AA531F385D 854A8D36-82C9-4D27-A6F9-2D72C714B3B6 46367EFC-B59C-46C7-BA54-CE38D3017355

When I restart safari, the scripts including test.user.js in userscripts are displayed in the list, but nothing works and when I refresh, the list fails to load.

Githubmaniak avatar Aug 26 '22 14:08 Githubmaniak

@Githubmaniak

can you try this script please?

// ==UserScript==
// @name          TestScript2
// @description   This is your new file, start writing code
// @match         <all_urls>
// @noframes
// ==/UserScript==

alert("This is a test script");

the original test script logs to the console (you wont see that in mobile)

and it also doesn't match to google.com domains

the test script I pasted above should work on google.com domains and show an alert

quoid avatar Aug 26 '22 14:08 quoid

@quoid 97B00E68-DC49-44B6-A3AD-16395E29BAD0 12FABF6F-DB4D-497F-BC0D-B33F8154DE16

Before that the script doesn't work on naver.com either, but this script works! But complex ad blocking scripts like namulink.user.js and microshield.user.js don't work on my iPhone 6S+.

Githubmaniak avatar Aug 26 '22 15:08 Githubmaniak

Before that the script doesn't work on naver.com either, but this script works! But complex ad blocking scripts like namulink.user.js and microshield.user.js don't work on my iPhone 6S+.

Can you link those userscripts?

There could be a compatibility issue. This userscript manager doesn't have all of the same APIs are others. If you send me the links, I can check to see what might be causing the issue.

Thanks

quoid avatar Aug 26 '22 16:08 quoid

@quoid https://github.com/List-KR/NamuLink, https://github.com/List-KR/microShield

Githubmaniak avatar Aug 26 '22 18:08 Githubmaniak

@Githubmaniak

NamuLink

Problems:

  1. Is using unsafeWindow. There is no equivalent for Safari. #252

  2. This check: const win = unsafeWindow != undefined ? unsafeWindow : window is better as const win = typeof unsafeWindow != "undefined" ? unsafeWindow : window, since attempting to see if a possibly undeclared variable is undefined can throw an error...

  3. The script will be injected into the content context because it has an @grant value, however since unsafeWindow is invalid, perhaps this shouldn't happen - #307

microShield has the same issue as 1 but has a proper check for unsafeWindow.

I can see the scripts get injected when these issues are resolved.

quoid avatar Aug 27 '22 03:08 quoid

closing due to inactivity, feel free to reopen if needed @Githubmaniak

quoid avatar Oct 11 '22 14:10 quoid