Links to external sites are opened inside Fogger

Bug #1023245 reported by Arturo Torres Sánchez on 2012-07-11
60
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Fogger
High
Owais Lone

Bug Description

I have a fog app for Facebook. If someone shares a link, it is opened in a new window, but of the same fog app.
It should open the link in the default browser, since the new page no longer corresponds to the fog app.

Hennie Marais (hennie-2) wrote :

I can confirm this as well. This happens when I click on links in my webmail and web rss aggregator applications.

Owais Lone (loneowais) wrote :

Thanks for reporting. This is a know issue but it is not as simple as it seems.

Checkout:
http://www.reddit.com/r/ubuntuappshowdown/comments/vvsgp/app_submission_fogger_desktop_integration/c584fd6

While opening in default browser is the desired behavior, sometimes it makes sense to open the new page right inside fogger. In cases where you want to authorize a 3rd party site to do something on your behalf or if you want to login to stackoverflow using Google or Launchpad. Also, detecting external links is not as straightforward.

Let's say you created a webapp for xyz.com and it points you to xyz1.com for some reason now all your links will have xyz1.com in them and fogger will think they are external.

Any ideas/suggestions are appreciated.

What do you think about these possible solutions

   1) Show an info bar on the window when a user has navigated away from the main site, this bar will contain two buttons
        * Go Home
        * Open in browser

     If the user clicks OPen in browser, fogger will immediately go back to actual webpage and then remember that the link is to be opened in a browser the next time. While this could work, it could get annoying real fast.

    2) Try to automatically detect external links and open them in browser. This sounds like a really good solution but there is no way of telling when a link must be opened inside fogger.

Changed in fogger:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Owais Lone (loneowais)
Owais Lone (loneowais) wrote :

Another issue is detecting if subdomains are external or internal. For Google apps it's certainly external but that might not be true for other domains.

I think we need a site specific solution here. Something like what is described in comment #1 on the reddit link above.

Hennie Marais (hennie-2) wrote :

Redirecting to a 3rd party site for authorization is often done via a 302/303/307 HTTP redirect, so that is one case one can be sure should be loaded inside fogger.

Anyway, I wonder if any of the signals provided by WebKitGTK+ can't be of use here? I'll take a look later in the day; I'm at work at the moment.

Owais Lone (loneowais) on 2012-07-11
Changed in fogger:
milestone: none → 0.2
Owais Lone (loneowais) wrote :

Thanks man!

Hennie Marais (hennie-2) wrote :

This won't resolve the problem, but here is what needs to be done to prevent the app for leaving a particular domain. This piece of code will ignore any navigation requests to any domain other than a domain containing google. This code should easily be adaptable to do what is described in the reddit comment.

--- AppWindow.py-original 2012-07-11 08:35:58.014348893 +0200
+++ AppWindow.py 2012-07-11 14:54:24.698717001 +0200
@@ -79,6 +79,7 @@
         self.webview.connect('geolocation-policy-decision-requested', self.on_request_geo_permission)
         self.webview.connect('create-web-view', self.on_create_webview)
         self.webview.connect('database-quota-exceeded', self.on_database_quota_exceeded)
+ self.webview.connect('navigation-policy-decision-requested', self.on_nav_request)
         frame = self.webview.get_main_frame()
         frame.connect('notify::load-status', self.on_frame_load_status)

@@ -91,6 +92,14 @@
             logger.error('Error reading fogger.js')
             self.js_lib = ""

+ def on_nav_request(self, view, frame, request, action, policy, data=None):
+ url = request.get_uri()
+ if url is None:
+ return False
+ elif 'google' not in url:
+ policy.ignore()
+ return True
+
     def inject_scripts(self):
         userscripts = self.app.scripts
         userscripts.insert(0, self.js_lib)

Hennie Marais (hennie-2) wrote :

Alright, I've implemented the regex suggestion from the reddit comment and attached the patches. I've introduces 2 new options in app.json to be able to do so. I've also attached the modified app.json

The new options are:
- domain_regex
- browser_cmd

Hennie Marais (hennie-2) wrote :

Forgot to mention that the domain_regex option is a list of regular expression that, if matched, means that the url will be opened in the WebkitView window. Anything else will be opened externally.

Browser_cmd is simply the command to run to open urls externally.

Owais Lone (loneowais) wrote :

Hi Hennie, thanks for the patch. I appreciate your effort but we have not decided how to solve this problem yet. I think this needs some more discussion both here and in other places. Implementing the regex matching is not an issue; the problem is the user workflow. Should users be able to force opening it in fogger? What kind of UI interaction do we want here?

Regex is for advanced users. How would we tackle this problem for the average user? There are a lot of questions to be answered before beginning to implement this.

I'll come back to this in a few days and will definitely use your patch or parts of it if needed.

Thanks a bunch!

Owais Lone (loneowais) on 2012-07-12
Changed in fogger:
milestone: 0.2 → 0.3

One thing you could include for now is an option for each app to define where to open links to external domains by default.
However, I think that links with target="_blank" are safe to be considered as external ones, and then can be opened on default browser instead that in a different fogger window.

Owais Lone (loneowais) wrote :

Marco, I'm not sure about that. I think it needs to be strictly based on url/domain checking. Many sites like to open stuff in new tabs like Google Docs. All documents open in new tabs. I think fogger should just check if the new location does not have the same TLD as that of the app and open the page in the browser but there should be a mechanism present to override the behavior on per link basis.

Well, yes of course the url/domain matching is the first thing... But if that doesn't match, the link target is something that should give you more security about what to do.

Couldn't it simply be defined by the user?

For this app open all Links externally, for the next app, open all internally.

I use fogger for the Zimbra Email Client and internal links are a pain, because people send you links all the time.

Until the “smart” way of handling external links is defined, I think
we should at least have an option in the context menu for opening the
link externally.

On 8/7/12, Marco Laspe (Rockiger) <email address hidden> wrote:
> Couldn't it simply be defined by the user?
>
> For this app open all Links externally, for the next app, open all
> internally.
>
> I use fogger for the Zimbra Email Client and internal links are a pain,
> because people send you links all the time.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1023245
>
> Title:
> Links to external sites are opened inside Fogger
>
> Status in Fogger:
> Triaged
>
> Bug description:
> I have a fog app for Facebook. If someone shares a link, it is opened in a
> new window, but of the same fog app.
> It should open the link in the default browser, since the new page no
> longer corresponds to the fog app.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/fogger/+bug/1023245/+subscriptions
>

--
—Arturo Torres Sánchez

dale f (manzanitalaceration) wrote :

Fogger is not a browser. By default it should open external links in the users browser. There may be situations like you point out Owais, but I think the vast majority of users, like me, will have link in and want it open in their browser (I am using this for gmail and greader). This is a big irritation in this otherwise spendid program. Couldn't you just have a right click option "open link within Fogger"?

Owais Lone (loneowais) wrote :

That is the plan but current webkit version does not support editing of context menu. It'll be possible in the next version (WebKit2) but we'll have a fix for 12.04 too.

“but current webkit version does not support editing of context menu”
So, for example, how does Midori get its context menu? It also uses
Webkit, as far as I know.

On 8/10/12, Owais Lone <email address hidden> wrote:
> That is the plan but current webkit version does not support editing of
> context menu. It'll be possible in the next version (WebKit2) but we'll
> have a fix for 12.04 too.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1023245
>
> Title:
> Links to external sites are opened inside Fogger
>
> Status in Fogger:
> Triaged
>
> Bug description:
> I have a fog app for Facebook. If someone shares a link, it is opened in a
> new window, but of the same fog app.
> It should open the link in the default browser, since the new page no
> longer corresponds to the fog app.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/fogger/+bug/1023245/+subscriptions
>

--
—Arturo Torres Sánchez

Owais Lone (loneowais) wrote :

The support is limited in the current version. You can export your own custom menu that replaces the default one (Cannot dynamically manipulate menus AFAIK). Newer versions will expose a much detailed context menu API where we'll be able to edit the menus (http://webkitgtk.org/reference/webkit2gtk/unstable/WebKitContextMenu.html)

I'm testing Fogger with Lotus Notes web application : when I click for an attached document, it opens in a new windows, ask for authentication and logs me off from the original Fogger window. I don't if it's related to this bug but this makes Fogger useles in this particular use case. Is there a work around ?

Ian Young (youngian) wrote :

Maybe you could expose the ability to open a link externally through the API. That way, even if Fogger doesn't do it by default, we could at least install a custom script to handle it.

Jan Harders (janhh) wrote :

Are there any upates regarding this?
I'd like to use fogger to manage multiple hipchat-Accounts, but I'd always want any external links to open in my main browser of course. Is there an easy/official way to do it or do I have to apply Hennie's patch?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments