Júlio Griebeler
Júlio Griebeler

Reputation: 892

How to know if browser is embedded in other application?

I work with an extension from Sketchup that opens a webdialog ( from the default OS browser - in windows is IE, but without menu and other bars ), but this page can be acessed by a browser(not embedded - can be all browsers). I need know (with javascript/jquery) if the user browser is embedded in another application. Anyone have a solution?

Upvotes: 2

Views: 732

Answers (2)

Barry
Barry

Reputation: 11

Check userAgent. In SketchUp 16.1 on Mac for example, navigator.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.6 (KHTML, like Gecko) SketchUp/16.1 (Mac; Safari)"

Upvotes: 0

Riaan Walters
Riaan Walters

Reputation: 2666

Here you go, this will detect if a page is loaded in an iframe

if (window!=window.top) { /* I'm in a frame! */ }

Upvotes: 4

Related Questions