Questions tagged [wkuserscript]

Used when a user script is to be injected into a webpage.

Used when a user script is to be injected into a webpage.

9 questions
7
votes
2 answers

WKUserScript not working

I want to inject a script using WKWebview API. For some reason it isn't working and I can't figure it out. I've tried debugging in Safari developer console and I can't find the JavaScript code in there either. Implementation Code as…
Avba
  • 14,822
  • 20
  • 92
  • 192
2
votes
0 answers

How to evaluateJavaScript when app goes to background WKWebView?

I am create html page with HTML5 IMA SDK player and then load this page to WKWebView, all work fine pause, playing content etc, but I want "pause" content when app goes to background for achieve this I did tried used "WKWebView evaluateJavaScript"…
Ice
  • 680
  • 1
  • 10
  • 23
2
votes
0 answers

javascript injection not being executed

I have included my function and the way im calling it it does print "injecting" in console but the javascript dosent seem to be injected i have tested the js in safari console and chrome console it works but dosent work in the wkwebview…
kishan
  • 47
  • 9
1
vote
2 answers

Removing a single specific user script from WKUserContentController

I'm using addUserScript() to add a user script to my WKWebView's WKUserContentController. I noticed that even if call loadRequest() the script stays around. For certain use cases I may need to remove certain scripts and add others. However, it…
Locksleyu
  • 5,192
  • 8
  • 52
  • 77
1
vote
2 answers

Refresh an external webpage every few seconds

For work, I spend a lot of time on domain-specific forums. Throughout the day, I check those forums to see if there are any questions and answers relevant to what I am working on. However, the particular site I am using does not automatically…
0
votes
0 answers

Safari Userscript Injection

Problem and screenshots [][]How do I inject a userscript into safari using apple shortcuts? I have my script all written but when I try to run it on the website (in this instance, nitrotype.com/race) it doesn’t do anything. Here are some…
0
votes
1 answer

WKUserScript forMainFrameOnly

WKUserScript has this init init(source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool) Simply what is meant by 'MainFrame' ?
RyanTCB
  • 7,400
  • 5
  • 42
  • 62
0
votes
1 answer

WKUserScript not call in iOS10, but works in iOS9

I'm having code which perfectly works in iOS 9, but not working in iOS 10, specifically doBar() not called. Here in WKWebView I'm injecting javascript code. let jsFoo = "function doFoo() { window.webkit.messageHandlers.doFoo.postMessage(\"doFoo\");…
Jurasic
  • 1,845
  • 1
  • 23
  • 29
-1
votes
1 answer

WKUserScript init Crash on iOS 14: Use of unimplemented initializer init(source:injectionTime:forMainFrameOnly:in:)

Crash while executing this init method in ios 14 Use of unimplemented initializer init(source:injectionTime:forMainFrameOnly:in:) class MyScript: WKUserScript { init(source: String) { super.init(source: source, injectionTime:…
Saqib2235
  • 41
  • 5