[bug][fix][bug][fix] multiple browsers

Mark Guzdial guzdial at cc.gatech.edu
Tue Apr 20 17:24:24 UTC 1999


There are situations where my previous fix didn't work.  The below one has
worked the last hour for me.

'From Squeak 2.3 of January 14, 1999 on 20 April 1999 at 1:23:27 pm'!

!TextURL methodsFor: 'as yet unclassified' stamp: 'mjg 4/20/1999 12:40'!
actOnClickFor: anObject
	"Do what you can with this URL.  Later a web browser."

	| response m browser |

		"if it's a web browser, tell it to jump"
		(anObject isWebBrowser) ifTrue: [anObject jumpToUrl: url.
^true]
		ifFalse: [anObject model isWebBrowser ifTrue: [anObject
model jumpToUrl: url. ^true]].

		"if it's a morph, see if it is contained in a web browser"
		(anObject isKindOf: Morph) ifTrue: [
			m _ anObject.
			[ m ~= nil ] whileTrue: [
				(m isWebBrowser) ifTrue: [
					m  jumpToUrl: url.
					^true ].
				(m hasProperty: #webBrowserView) ifTrue: [
					m model jumpToUrl: url.
					^true ].
				m _ m owner. ]
		].

	"no browser in sight.  ask if we should start a new browser"
	(self confirm: 'open a browser to view this URL?') ifTrue: [
		browser _ Scamper new.
		browser jumpToUrl: url.
		browser openAsMorph.
		^ true ].

	"couldn't display in a browser.  Offer to put up just the source"

	response _ (PopUpMenu labels: 'View web page as source\Cancel' withCRs)
		startUpWithCaption: 'Couldn''t find a web browser.  View
page as source?'.
	response = 1 ifTrue: [HTTPSocket httpShowPage: url].
	^ true! !

--------------------------
Mark Guzdial : Georgia Tech : College of Computing : Atlanta, GA 30332-0280
(404) 894-5618 : Fax (404) 894-0673 : guzdial at cc.gatech.edu
http://www.cc.gatech.edu/gvu/people/Faculty/Mark.Guzdial.html





More information about the Squeak-dev mailing list