Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Make Safari open links from applications in the current space' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Make Safari open links from applications in the current space
Authored by: burgerga123 on Oct 28, '09 12:35:20PM

Well I kind of fixed it. I realized I had Spaces set to always open Safari in Tab 1. I removed this requirement and it now opens it in the current tab. The only problem is it opens it along with a blank window. I think the problem is with the applescript. From what I can tell (I don't know much AS code), it seems like it is telling Safari to open a new window, then open the url, which opens a new window of it's own. I'm assuming the first open window is required to get safari to open the link in the current space. Any ideas?



[ Reply to This | # ]
Make Safari open links from applications in the current space
Authored by: everkleer80 on Oct 28, '09 01:27:24PM

You seem to be referring to different spaces as 'tabs' whereas the OP is referring to the tabs in the Safari window when they say they have Safari's "preferences set to open links from applications in a new tab in the current window." This is a setting in Safari's preferences under "tabs" and it keeps Safari from opening the new window you are seeing. I suspect that you have this setting turned off. If so then I think turning this setting on would be the solution.



[ Reply to This | # ]
Make Safari open links from applications in the current space
Authored by: everkleer80 on Oct 28, '09 03:35:29PM

Sorry, since I was not at home when I wrote that, I tried to tell you where the setting was from memory and, of course, got it wrong. It is actually under General in Preferences and the choices are "in a new window" or "in a new tab in the current window" and jaysoffian had "in a new tab..." selected. I just did a test and if you are using the "in a new window" option then you do not need this hint as everything should already work; this is only needed when Safari is set to open links in an existing window and the existing window happens to be in another space.



[ Reply to This | # ]
Make Safari open links from applications in the current space
Authored by: burgerga123 on Oct 29, '09 01:08:27PM
My bad, I was using the wrong words :) When I said tab I meant space. Anyways, I sort of have this working now. I set Safari to open links in new tabs instead of new windows. So then when the link was clicked the new window would open in the current space and then the link would open in a new tab. This however means that the new safari window had two open tabs, one with the link and one Top Sites tab. I wrote a bit of script to the end of the URLHelper App to make Safari close the first tab, this generally works except when Safari already had an open window, then it closed the first tab anyways, even if it had something open.

So i just worked on it a bit more and modified the if else statement of the code. It's working perfectly now:


on open location theURL
	tell application "System Events"
		if (count of windows of process "Safari") = 0 then
			tell application "Safari" to make new document
			tell application "Safari" to open location theURL
			tell application "Safari" to close first item of tabs of first item of windows
		else
			tell application "Safari" to open location theURL
		end if
	end tell
end open location
Have fun with this. I'm liking it already :)

[ Reply to This | # ]