Safari View Controller
For displaying read-only web content.
Requires Cordova plugin: cordova-plugin-safariviewcontroller
. For more info, please see the Safari View Controller plugin docs.
联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.
Ionic Safari View Controller插件的安装(Installation)
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
Ionic Safari View Controller插件支持的平台(Supported Platforms)
- Android
- iOS
Ionic Safari View Controller插件的用法(Usage)
import { SafariViewController } from '@ionic-native/safari-view-controller/ngx';
constructor(private safariViewController: SafariViewController) { }
...
this.safariViewController.isAvailable()
.then((available: boolean) => {
if (available) {
this.safariViewController.show({
url: 'http://ionic.io',
hidden: false,
animated: false,
transition: 'curl',
enterReaderModeIfAvailable: true,
tintColor: '#ff0000'
})
.subscribe((result: any) => {
if(result.event === 'opened') console.log('Opened');
else if(result.event === 'loaded') console.log('Loaded');
else if(result.event === 'closed') console.log('Closed');
},
(error: any) => console.error(error)
);
} else {
// use fallback browser, example InAppBrowser
}
}
);