Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to open links in Google Chrome instead of Safari #11

Open
rbugajewski opened this issue Mar 16, 2013 · 3 comments
Open

Ability to open links in Google Chrome instead of Safari #11

rbugajewski opened this issue Mar 16, 2013 · 3 comments

Comments

@rbugajewski
Copy link

It would be nice if the app could open all external links in Chrome instead of Safari. This requires changing all URLs in the header and article.

I coded a short hack today that works for me:

diff --git a/conf.js-dist b/conf.js-dist
index 6e43e61..716d0f5 100644
--- a/conf.js-dist
+++ b/conf.js-dist
@@ -10,3 +10,6 @@ window.apiPath="/tt-rss/";
 /* relative URL from the root to access this webapp */
 window.webappPath="/ttrss-mobile/";

+/* Should links be opened in Google Chrome instead Safari? */
+window.useChrome=0
+
diff --git a/main.js b/main.js
index 30168ea..129618f 100644
--- a/main.js
+++ b/main.js
@@ -832,6 +832,11 @@ function defineViews(){
         // apply content filters
         article = cleanArticle(article, this.model.get("link"));

+        if (window.useChrome)
+        {
+          article = article.replace(/(<a href=")http/g, "$1googlechrome");
+        }
+
         // display article
         $contentDiv.html(article);

The only cases where this wouldn’t work (and I could think of at the moment) are:

  1. Environments outside of iOS where googlechrome(s):// is not present.
  2. <pre> and similar environments that don’t render HTML and where the regular expression would match nonetheless.
@mboinet
Copy link
Owner

mboinet commented Mar 17, 2013

Thanks for the input. I think I'll go with a settings page where the user can choose the preferred browser. See issue #8

I'm also using Chrome and find it annoying when it opens in Safari ;-)

@rogierlommers
Copy link

Cool!

@rogierlommers
Copy link

Any idea when we can expect this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants