James Dewes
James Dewes

Reputation: 387

How can a webpage tell if it is open in a webapp view without referrer?

For Android and for iOS, can you detect if a page is being opened in a webapp view using just JavaScript without referrer information? For example where the script is on the second page accessed on the same domain?

Upvotes: 2

Views: 175

Answers (2)

Martin
Martin

Reputation: 16292

The way we have achieved this is to modify the UserAgent string in our native app. We insert the name of our app to the end of the useragent string.

Then our WebApp can tell if it is being loaded within the Android or IOS native app.

Other methods could be having the Native app always pass a specific query string, like ?native=true, or hash, #!?native=true.

Upvotes: 1

Juha Tauriainen
Juha Tauriainen

Reputation: 1611

You would need to control both of those websites, build some sort of api to push and read data on the websites open on the tabs.

Browsers themselves do not offer an api for this purpose.

If you would build your own custom web browser app for iOS or Android, I'm sure you could implement what ever api's to let your tabs know what pages are open on other tabs.

Upvotes: 0

Related Questions