Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8569747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:24:30+00:00 2026-06-11T18:24:30+00:00

I have a native iOS app that can be called from Mobile Safari in

  • 0

I have a native iOS app that can be called from Mobile Safari in iOS via myiosapp://. I also have a simple Rails app that SHOULD redirect to the native app when the request is coming from mobile. This is where I am I having problems – I can’t redirect_to 'myiosapp://

I want to describe this problem as short as possible, so I made a sample app that shaves away the irrelevant information, but replicates the same problem.

Here’s my routes.rb:

MyRailsApp::Application.routes.draw do
  root :to => 'redirect#index'
end

And here’s redirect_controller.rb:

class RedirectController < ApplicationController
  def index
    if request_from_mobile?
      redirect_to "myiosapp://"
    else
      redirect_to "/default.html"
    end
  end

  private

  def request_from_mobile?
    request.user_agent =~ /Mobile|webOS/
  end
end

Whenever I run rails server and go to localhost::3000, I get this:

Started GET "/" for 127.0.0.1 at 2012-09-21 14:00:52 +0800
Processing by RedirectController#index as HTML
Redirected to motionapp://
Completed 302 Found in 0ms (ActiveRecord: 0.0ms)
[2012-09-21 14:00:52] ERROR URI::InvalidURIError: bad URI(absolute but no path): motionapp://
    /Users/dev/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri/generic.rb:1202:in `rescue in merge'
    /Users/dev/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri/generic.rb:1199:in `merge'
    /Users/dev/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpresponse.rb:220:in `setup_header'
    /Users/dev/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpresponse.rb:150:in `send_response'
    /Users/dev/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:110:in `run'
    /Users/dev/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

Before posting this, I’ve already seen a number of similar problems, but none seemed to be more specific to how I can implement this in Rails:

How to redirect from Mobile Safari to Native iOS app (like Quora)?

iphone web app to automatically redirect to app

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:24:32+00:00Added an answer on June 11, 2026 at 6:24 pm

    Turns out there’s a simple solution that is enough for the context of my app as of the moment. I just needed to handle the redirect in javascript. Other solutions are still welcome. 🙂

    <html><head>
        <script type="text/javascript">
          var userAgent = window.navigator.userAgent;
          if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
            window.location = "myiosapp://"
          }
        </script>
      </head>
      <body>
        Some html page
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that can be accessed on mobile phones, both iOS and
Hi i have native ios app And i have old version that not compitible
I followed the login instructions for my native iOS app here https://developers.facebook.com/docs/mobile/ios/build/ I have
On the Facebook counterpart of a native iOS app: what's the worst that can
I have a couple of Android and iOS native mobile application that I wrote
I'm working on a quite simple native extension for Adobe Air powered iOS app.
I have a native objective c ios application that I would like to convert
Let's say I have a web app that calls out to a native app
We have an iOS app that publishes certain activity to Facebook that contains links
I have an existing iOS app on the App Store that includes Game Center

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.