-
Notifications
You must be signed in to change notification settings - Fork 71
Control of the WebView from an independent javascript instance. #303
Copy link
Copy link
Open
Description
Feature Request
Motivation Behind Feature
This feature would enable:
- Modifying html before loading it (i.e. rendering it with some templating engine).
- Smooth development using multi-page app architecture.
Feature Description
An option to run Cordova apps with a "background" javascript instance that could control and communicate with the WebView.
Alternatives or Workarounds
As an alternative you can use a single html file containing an iframe and scripts. Instead of loading desired pages in WebView the app would read the html file, render it adding mutation observers, write contents to a different file and then load that file in an iframe.
Drawbacks of the workaround:
- Apps become harder to debug.
- Unnecessary file reads/writes.
- Mutation observers have to be rendered into html in order to override link behavior. So that the iframe would send a message back to WebView making it read the next html file, render, write and load it in the iframe.
- On android platform
applicationDirectoryis read only, so you have to write the rendered html file to a different directory. In this case you have to either: copy all resources that are loaded using relative paths into the same directory or modify relative path when rendering html.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.