Jump to content
Subject22

Open current Safari tab in Chrome - Improved

Recommended Posts

I removed Flash from my system long ago but occasionally I need to make use of the version bundled with Chrome to view certain web pages properly. There are a few workflows like this around, but as the only browsers I use are Safari and Chrome I wanted something a little more direct than Send URL which led me to this alternative made by Runar. There were a few issues with that workflow, so I made a version which (hopefully) deals with everything in a tidy and intelligent manner. 
 
If Safari is either not open, or has no windows open, the workflow will post a notification saying so. If you'd like it to also post notifications when URLs are successfully sent to Chrome open the workflow folder (right click the workflow in Alfred and click Show in Finder) and edit the appropriate line in open_in_chrome.scpt (it's clearly marked). The reverse behaviour is also available (i.e.: sending URLs from Chrome to Safari).
 

Open%20in%20Chrome%20-%20Screenshot.png

 
 
Hat tip to Carlos-Sz for getting Alfred to run the Applescript properly 🙂
 
Download (v1.0.2): Open in Chrome

GitHub
Keywords: openinchrome, openinsafari

Edited by Subject22

Share this post


Link to post

i like this but is there a way to make it open on a new chrome tab.

Right now, if I have a chrome window currently open and activate this workflow, it will activate in my current chrome tab and i think it is better if it opened a new tab instead of replacing it.

Share this post


Link to post

That's a fair point. I've updated the script behind the current link. Just download a new copy, reimport it and let me know if it does what you want :-) I also added logic to see if the current Safari tab is already open in Chrome, in which case the workflow will post a notification saying so and take no further action.

Share this post


Link to post

is the updated workflow link the one in your original post (dropbox)?

it still replaces instead of opening new tab.

it might be some problem on my end so if there's any test you want me to run, that's fine.

Edited by James

Share this post


Link to post

Oh that is bizarre. The file that that link refers to on my local machine is correct. The file that that link refers to on my dropbox account online is correct. But actually clicking that link serves up an old version of the file. Try this: http://d.pr/f/Q7vP. Link in the first post now works again.

Edited by Subject22

Share this post


Link to post

Is there any way you could make a version of this WorkFlow that does the opposite or just tell me how to manipulate the apple script to do the opposite (open chrome tab in Safari)? I often find that certain sites require the use of Safari for whatever reason. ex. DirectTV requires it for viewing of On Demand programming online. Thanks for the help. 

Edited by seandoherty91

Share this post


Link to post

Off the top of my head, opening the AppleScript in the workflow folder and changing every instance of "Chrome" to "Safari" and every instance of "Safari" to "Chrome" ought to work. Try it anyway and if it doesn't do what you want let me know and I'll take a look when I can :-)

Share this post


Link to post

Hey there,

 

Thanks for this extension. I use it all the time and previous solutions had been unreliable.

 

I'm having trouble getting this to work properly when chrome is not already open. When I invoke the shortcut, it opens Chrome but won't send the link through. If I go back to safari and invoke the shortcut a second time, it works perfectly. If Chrome is already open, it also works perfectly.

 

Any ideas here?

 

Thanks!

Share this post


Link to post

OK, that's interesting, it definitely works fine on my end. I can't look into that right at the moment, but I'll get back to you when I get a chance. Roughly how long does it take Chrome to launch from closed for you? In seconds, and 'bounces' if you can.

Share this post


Link to post

Thanks, and no rush at all. Chrome takes just a second to launch, maybe one bounce, if even.

 

I'm now noticing that if I don't have any windows open and leave chrome open, the extension doesn't work at all. Chrome becomes the active application, but the link doesn't open in chrome unless i have a window already open.

 

Thanks again!

Share this post


Link to post

Hey hey,

 

I was having the same issue. I got around it by having the openinchrome workflow also open up chrome when I go to use it (see below). With this method, if chrome is already open it just adds an extra tab, whereas if it's not it opens up a new window. The only slight glitch is that in the latter case it opens up an extra tab as well, but it's not a real problem unless you're a perfectionist.

 

temp.png

Share this post


Link to post

Hi there,

 

I'm posting here because I find this workflow very interesting, but I'm using SRWare Iron instead of Chrome. So I modified it to make it work with Iron too, and you can see my workflow on this topic.

 

I also noticed the problem when you have no window opened in Chrome so I changed the script in my workflow to solve this problem. I invite you, Subject22, to use my modified script to solve this problem in your workflow as well if you think it's a better solution ;).

 

Thanks

Axel

Share this post


Link to post

I'm currently working 8am-3am days (well, studying, technically), and probably will be for the next few weeks, but if you're still having trouble on, say, the 24th of June post here again mrwayne and I'll be happy to look into it :-)

Share this post


Link to post

Hi there,

I've found that there is still no method to open the current tab in Chrome when it has no window already opened. Although we can change the workflow to let Chrome opening new window like avi_tp's suggest, but it would opens up an extra tab as well. So I just re-writed a little code to make the script run correctly, now you can use this script and don't need to worried about whether there's a window opened or not. Below is the updated workflow, thanks.

Download: Open in Chrome

Edited by Jude

Share this post


Link to post

Thanks for that Jude! I've gone ahead and modified the script myself anyway (you can re-download it from the same link in the first post). The new version tidies up that annoying extra "blank" tab in addition to working when Chrome doesn't have a window open. If someone could confirm that everything works now that'd be great :-)

Edited by Subject22

Share this post


Link to post

Hey,

 

Thanks for this great workflow!

 

I have customized it and added this at line 6, in order to close the tab in Safari automatically:

close (every tab of front window whose name is equal to pageName)

Very useful to me, so I thought it could be interesting to share :)

Edited by Xavier

Share this post


Link to post

No problem! I thought about implementing an auto-close feature but decided against it as it seemed like a personal preference sort of thing. Thanks for posting your code, hopefully other people'll find it useful :-)

Share this post


Link to post

Thank you so much for this awesomeness. Works perfectly.

But I've been really frustrated with no code for the reverse action, as in "Open Chrome tab in Safari." I'm no coder but your code made it very easy for me to modify. Replacing "Chrome"s with "Safari"s and vice versa didn't work because one uses "active tab" and the other "current tab." So I changed them accordingly as well. There were a few other problems but nothing I couldn't solve with some Googling. So now I can immediately switch between the two whenever I want by using this code with yours:  http://d.pr/f/zsom

 

However there are some kinks.

1) If Safari is open but there is no window, the script doesn't work. Just brings the windowless Safari to focus and dies.

2) If Safari is completely closed, the script works only sometimes. Sometimes it just opens a new blank window but doesn't open the page, and sometimes works as it should.

 

It would be awesome if someone could clean out these kinks. I guess they should be easy enough to deal with, but I simply don't know how.

 

Thanks again.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...