How to open two different home pages on start up?
Having two different Home Pages automatically opening at start up in two different tabbed windows is possible by using inline
JavaScript, HTML with
JavaScript or
AppleScript (with or without timeout).
Important: If you choose one of the
JavaScript solutions, don't forget to uncheck the
access Referer
and check the
open windows automatically
of the
JavaScript Filter
section in the preferences. Also, I advise you to choose
Referer: Only within the same domain
in the
HTTP/DNS
(network) preferences. (Disabling the referers is necessary for security reasons:
document.referrer
of
JavaScript can get a local path with iCab and IE. I'm afraid it's dangerous.)
HTML with JavaScript solution
Download the HTML file
hompages.html (that's
option-click on the link in iCab) and change its contents to fit your home pages. Then drag & drop it into the
URL
field of the
Default Home page
preferences.
Inline JavaScript solution
Use one of the following as value for your home page URL in the preferences:
-
<code>javascript:window.open('http://www.google.com/');location.href='http://www.apple.com';void(0)</code>
-
<code>javascript:void(window.location.href="http://telcontar.net");void(window.open("http://www.google.com/"));</code>
Note that there is a length limit on the home page URL field (currently, 256 chars).
AppleScript solution
Save this script as application and double-click it instead of iCab icon.
tell application "iCab"
Activate
OpenURL "http://www.apple.com/" toWindow -1
OpenURL "http://www.google.com/" toWindow -2
OpenURL "http://www.yahoo.com" toWindow -2
end tell
AppleScript solution with timeout
I've heard that iCab sometimes fails to return the result of
OpenURL,
and I don't guess the connection speed has something to do with the problem. The solution will be as follows:
tell application "iCab"
Activate
try
with timeout of 1 second
OpenURL "http://www.apple.com/" toWindow 0
end timeout
end try
try
with timeout of 1 second
OpenURL "http://www.google.com/" toWindow -2
end timeout
end try
try
with timeout of 1 second
OpenURL "http://www.yahoo.com/" toWindow -2
end timeout
end try
end tell
-- Ken