> ## Content Index
> Fetch the complete content index at: https://developerinsider.co/llms.txt
> Use this file to discover other available public pages before exploring further.

# Handle query parameters in Universal Links
- URL: https://developerinsider.co/handle-query-parameters-in-universal-links/
- Published: 2016-03-13T10:54:49.000Z
- Updated: 2019-03-13T09:35:57.000Z
- Author: Vineet Choudhary
- Tags: iOS, Universal Links

In this article I'll show how to handle query parameters in Universal Links.

Currently #(inline-links) and ?(query-parmeter) not supported by `Universal Links`. Apple not provided any format to support `Inline-Links` & `Query-Parmeter` in `apple-app-site-association` file.

In order to do indexing to *www.mywebsite.com?parameter=something*, I'm using the following json file.

```json
{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "TEAMID.BUNDLEID",
        "paths":[ "*" ]
      }
    ]
  }
}

```

If you want to limit the indexing only to some parameter for example `query_parmeter1` and `query_parmeter2` then you need to handle this in UIApplicationDelegate method `[UIApplicationDelegate application: continueUserActivity: restorationHandler:]` something like this

**Objective-C:**

```objectivec
-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler{
    if ([userActivity.activityType isEqualToString: NSUserActivityTypeBrowsingWeb]) {
        NSURL *url = userActivity.webpageURL;
        if ([url.query containsString:@"query_parmeter1"]) {
           //handle code for query_parmeter1
        }else if ([url.query containsString:@"query_parmeter2"]){
           //handle code for query_parmeter2
      
        return YES;
    }
    return NO;
} 

```

**Swift:**

```swift
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
    if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
        let url = userActivity.webpageURL!
        let query = url.query ??
        if query.contains("query_parmeter1") {
            // handle code for query_parmeter1
        } else if query.contains("query_parmeter2") {
            // handle code for query_parmeter2
      
        return true
  
    return false
}

```

**Note:** This trick won't prevent the app from opening when a link to the website is clicked. But you can check If URL meets your requirement or not if not then you can open your URL in the web browser again. Similar to Amazon App -

![](https://github.com/developerinsider/developer-insider-content/blob/master/POST/iOS/Swift/UniversalLinksFallBack.gif?raw=true)