0

I have a webpage and I want to interact via JavaScript with it (to get data and to perform input events) that means I want to load the webpage in background.

In iOS i could do this easily with WebKit and a webView + the evaluateJavaScript Method, but since I want to run this on Apple Watch and the fact that there isn't a WebKit framework for watchOS, I am looking for another way to do this.

Any ideas?

2 Answers2

0

There is no way to run JavaScript code on watchOS at the moment. You should either port the code to Swift/Obj-C and run it natively on watchOS or you have to run the JS code in the iOS app, then send over the evaluated data to the Watch app using the WatchConnectivity framework.

Since there is no web browser on watchOS (and most likely there won't be one in the near future either), there would be no point in porting the WebKit framework to watchOS, so I suggest you find a permanent alternative for your problem.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
0

As of watchOS 5:

Apple has ported WebKit to watchOS, which opens up a lot of possibilities. You can view web content from your watch.

Source: Apple introduces watchOS 5 | TechCrunch

Benjamin Oakes
  • 12,262
  • 12
  • 65
  • 83
  • 1
    How can you actually access it? I cannot find it anywhere in Interface Builder and I can't find a documentation on that either – user2875404 Jun 05 '18 at 11:49