{"id":22705166,"url":"https://github.com/gedysintraware/cordova-plugin-webview-switch","last_synced_at":"2025-04-13T10:54:20.752Z","repository":{"id":57209162,"uuid":"165243297","full_name":"GEDYSIntraWare/cordova-plugin-webview-switch","owner":"GEDYSIntraWare","description":"Experimental plugin to switch the Cordova webview and hostname at runtime","archived":false,"fork":false,"pushed_at":"2021-02-11T09:26:33.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T15:58:54.081Z","etag":null,"topics":["cordova","cordova-ios","cordova-webview","ios","uiwebview","webview","webview-switch","wkwebview"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GEDYSIntraWare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-11T12:51:23.000Z","updated_at":"2022-04-26T08:11:48.000Z","dependencies_parsed_at":"2022-08-26T17:31:34.491Z","dependency_job_id":null,"html_url":"https://github.com/GEDYSIntraWare/cordova-plugin-webview-switch","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GEDYSIntraWare%2Fcordova-plugin-webview-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GEDYSIntraWare%2Fcordova-plugin-webview-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GEDYSIntraWare%2Fcordova-plugin-webview-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GEDYSIntraWare%2Fcordova-plugin-webview-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GEDYSIntraWare","download_url":"https://codeload.github.com/GEDYSIntraWare/cordova-plugin-webview-switch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248702999,"owners_count":21148116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cordova","cordova-ios","cordova-webview","ios","uiwebview","webview","webview-switch","wkwebview"],"created_at":"2024-12-10T09:09:23.744Z","updated_at":"2025-04-13T10:54:20.721Z","avatar_url":"https://github.com/GEDYSIntraWare.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cordova-plugin-webview-switch\n\n## Experimental plugin to switch the webview and origin at runtime.\n\n\u003e Please read warning and do not use it in production apps.\n\n# Attention :warning:\n\nThis plugin only loads webviews, installed as plugins, like [WKWebView](https://github.com/apache/cordova-plugin-wkwebview-engine) or [Ionic WKWebView](https://github.com/ionic-team/cordova-plugin-ionic-webview). App crashes and incompatibilities with Cordova updates may occurr.\n\nIf callbacks from plugins fire after reloading the webview, the app will crash.\n\n## Use with caution!\n\n**After calling `load()` the main view in the app will restart!**\n\n## Webview switching\n\n\u003e iOS only now\n\n**WebViews must be installed as plugins such as:**\n\nInstall WKWebview plugin(s) and [configure](https://github.com/apache/cordova-plugin-wkwebview-engine#required-permissions) it as default in config.xml:\n\n* [Apache WKWebView](https://github.com/apache/cordova-plugin-wkwebview-engine)\n* [Ionic WKWebView](https://github.com/ionic-team/cordova-plugin-ionic-webview)\n\n````xml\n\u003cfeature name=\"CDVWKWebViewEngine\"\u003e\n  \u003cparam name=\"ios-package\" value=\"CDVWKWebViewEngine\" /\u003e\n\u003c/feature\u003e\n\n\u003cpreference name=\"CordovaWebViewEngine\" value=\"CDVWKWebViewEngine\" /\u003e\n````\n\nThis plugin creates the global Javascript object `WebviewSwitch` which has the funtion `load()`to switch the Cordova webview (plugin).\n\nExamples:\n* Switch to default Cordova UIWebview at runtime: `WebviewSwitch.load('CDVUIWebViewEngine')`\n* Switch to WKWebview at runtime: `WebviewSwitch.load('CDVWKWebViewEngine')`\n* The In-App-Browser plugin works too and shares the session. But don´t forget to set `usewkwebview` to the correct value if you need a shared session.\n\n## Hostname switching\n\n\u003e iOS only now\n\n**:warning: This is just useful as a workaround for a webkit bug and may break anytime!**\n\nYou should avoid this method, since it reloads the webview as well. But it can be a workaround for this [webkit bug](https://bugs.webkit.org/show_bug.cgi?id=200857), which prevents apps running in Ionic webview from using cookies. Handle with care since it might affect your applications security and stability.\n\nThe [Ionic webview plugin](https://github.com/ionic-team/cordova-plugin-ionic-webview) runs on a custom scheme. The default scheme is `ionic://localhost`, which can be changed at buildtime by setting `\u003cpreference name=\"Hostname\" value=\"app\" /\u003e` in config.xml.\n\nIf you need to change the hostname at runtime (for example for CORS issues for domains that can be configured in the app), this plugins offers the `setHostname(name)` method.\n\nIf you change the hostname like this `WebviewSwitch.setHostname('myserver.com')`, the app will reload and run with the origin `ionic://myserver.com`. This will treat HTTP requests to `myserver.com` as same-origin in current iOS.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgedysintraware%2Fcordova-plugin-webview-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgedysintraware%2Fcordova-plugin-webview-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgedysintraware%2Fcordova-plugin-webview-switch/lists"}