如何获取App/网站的Deep Link?Cordova应用iOS端检测App安装需URI Scheme
Hey there! I totally get the frustration here—Android's package name check is so straightforward, but iOS's URI Scheme requirement can feel like a roadblock. Let's walk through practical, actionable ways to track down ASOS's iOS URI Scheme, plus how to implement the check correctly to skip that unwanted website redirect.
1. Dig into the ASOS Website's Source Code
Since the ASOS website already redirects to the app when it's installed, the URI Scheme is definitely hiding in their web code. Here's how to uncover it:
- Open the ASOS website in a desktop browser, hit F12 to launch DevTools.
- Use the search function (Ctrl+F on Windows, Cmd+F on Mac) to look for terms like
asos://,scheme, oropenURL. You’ll likely spot a JavaScript snippet that tries to launch the app first, then falls back to the website. - For example, you might find code like this:
Theif (isIOS()) { window.location.href = 'asos://home'; setTimeout(() => { window.location.href = 'https://www.asos.com.au'; }, 1000); }asos://part here is exactly the URI Scheme you need.
2. Test Common Scheme Naming Patterns
Most apps use URI Schemes tied to their brand or package name. For ASOS, try these common candidates with your AppAvailability plugin first:
asos://asosapp://com.asos.app://
You can test them quickly with this snippet:
const testSchemes = ['asos://', 'asosapp://', 'com.asos.app://']; testSchemes.forEach(scheme => { appavailability.check( scheme, () => { console.log(`Working scheme found: ${scheme}`); // Launch the app directly instead of the website window.open(scheme, '_system'); }, () => { console.log(`Scheme ${scheme} didn't work`); } ); });
3. Inspect the App's Info.plist (Mac Only)
If you have access to a Mac, you can grab the ASOS app from the App Store and dig into its core files:
- Right-click the ASOS app in your Applications folder and select "Show Package Contents".
- Open the
Info.plistfile (use TextEdit or Xcode for easier reading). - Look for the
CFBundleURLSchemesarray—this lists every URI Scheme the app supports.
4. Reach Out to ASOS Developer Support
If the above methods don’t pan out, consider contacting ASOS’s developer support team. Some apps document their URI Schemes for third-party developers, or support teams can share this info directly if you explain your use case.
Critical Fix: Avoiding the Website Redirect
Once you have the correct URI Scheme, update your Cordova code to check for the app before redirecting to the website. Here’s the logic you need:
// Replace 'asos://' with the actual scheme you find appavailability.check( 'asos://', () => { // App is installed—launch it immediately window.open('asos://', '_system'); }, () => { // App not installed—fall back to the website window.open('https://www.asos.com.au', '_system'); } );
This way, you never send users to the website if the app is already on their device—exactly what you need to avoid that unwanted redirect.
内容的提问来源于stack exchange,提问作者Rikku Porta

