How can I see the address of a website in finder; like when in windows file explorer, right click on website name and properties to see the website address?

How can I see the address of a website in finder; like when in windows file explorer, right click on website name and properties to see the website address?

MacBook Air (2020 or later)

Posted on Jun 30, 2021 5:26 AM

Reply
Question marked as Top-ranking reply

Posted on Jul 2, 2021 9:14 AM

How about dragging and dropping a .webloc onto an AppleScript droplet that produces a horizontally scrollable URL window in an Apple alert dialog.


The result appears like the following and is automatically adaptable to changes in appearance mode:



  1. Open the Script Editor from the Dock > Launchpad > Others.
  2. Copy/paste the following AppleScript into the Script Editor and click the compile (hammer) icon.
  3. If you run it from the Script Editor use control+command+R, but the goal is to save as a droplet on your Desktop
  4. You want to save the AppleScript source first:
    1. File menu > Save
    2. File Format: Text
    3. Save as: webloc_scroll.applescript on your Desktop or other folder
    4. Save
  5. Now, save it as a droplet to your Desktop
    1. Option + File menu > Save As…
    2. File Format: Application
    3. Save as: webloc_scroll.app
    4. Options: None
    5. Save
  6. Quit Script Editor


When you first drop a .webloc on this droplet, you will receive a dialog like the following. Click OK.


Code to copy/paste into Script Editor:


(*
  webloc_droplet.applescript
  
  Drag and drop .webloc file onto this droplet and receive a scrollable URL in an alert
  Tested: macOS 11.4
  VikingOSX, 2021-07-02, Apple Support Communities, no warranties/support implied.
*)

use framework "Cocoa"
use AppleScript version "2.4" -- Yosemite or later
use scripting additions

property ca : current application
property FLT_MAX : 1.0E+37
property app_icon : "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns"

property extension_list : {".webloc"}
property typeIDs_list : {"com.apple.web-internet-location"}

on open these_items
	tell application "Finder"
		repeat with afile in these_items
			if afile's kind is "Web internet location" then
				set theLocation to (afile's location) as text
				my show_URL_path(theLocation)
			else
				log "NOOP" -- ignore items that are not .webloc
			end if
		end repeat
	end tell
end open
return

on show_URL_path(aURL)
	
	set fg to ca's NSColor's textColor()
	set bg to ca's NSColor's textBackgroundColor()
	set alertIcon to ca's NSImage's alloc()'s initByReferencingFile:app_icon
	
	set attrsDict to ca's NSDictionary's dictionaryWithObjects:{ca's NSFont's boldSystemFontOfSize:16.0, fg, bg} forKeys:{ca's NSFontAttributeName, ca's NSForegroundColorAttributeName, ca's NSBackgroundColorAttributeName}
	
	set aStr to ca's NSAttributedString's alloc()'s initWithString:aURL attributes:attrsDict
	set frame to ca's NSMakeRect(0, 0, 310, 36)
	set myalert to ca's NSAlert's alloc()'s init()
	set scrollview to ca's NSScrollView's alloc()'s initWithFrame:(ca's NSMakeRect(0, 0, 310, 36))
	set contentSize to scrollview's contentSize()
	
	set theTextView to ca's NSTextView's alloc()'s initWithFrame:(ca's NSMakeRect(0, 0, contentSize's width(), contentSize's height()))
	
	tell theTextView
		its setMinSize:(ca's NSMakeSize(0.0, contentSize's height()))
		its setMaxSize:(ca's NSMakeSize(FLT_MAX, FLT_MAX))
		set layoutSize to its maxSize()
		its setVerticallyResizable:false
		its setHorizontallyResizable:true
		its setAutoresizingMask:(2 as integer) -- NSViewWidthSizable
		its (textContainer()'s setWidthTracksTextView:false)
		its (textContainer()'s setContainerSize:layoutSize)
		its (textStorage()'s setAttributedString:aStr)
		its setEditable:false
		
	end tell
	
	tell scrollview
		its setBorderType:(ca's NSNoBorder)
		its setHasVerticalScroller:false
		its setHasHorizontalScroller:true
		its setAutohidesScrollers:true
		its setDrawsBackground:true
		its setBackgroundColor:(ca's NSColor's clearColor())
		its setAutoresizingMask:(18 as integer) -- NSViewWidthSizable | NSViewHeightSizable
		its (contentView()'s addSubview:theTextView)
		its (contentView's setFrame:(ca's NSMakeRect(0, 0, 310, 36)))
		its setDocumentView:theTextView
	end tell
	
	tell myalert
		its setMessageText:"Selected Webloc URL String"
		its setIcon:alertIcon
		its setInformativeText:""
		its setAlertStyle:(ca's NSInformationalAlertStyle)
		its setAccessoryView:scrollview
	end tell
	
	set button to myalert's runModal()
	
	# theTextView's release()
	# scrollview's release()
	# myalert's release()
	
end show_URL_path


4 replies
Question marked as Top-ranking reply

Jul 2, 2021 9:14 AM in response to jeff.swims

How about dragging and dropping a .webloc onto an AppleScript droplet that produces a horizontally scrollable URL window in an Apple alert dialog.


The result appears like the following and is automatically adaptable to changes in appearance mode:



  1. Open the Script Editor from the Dock > Launchpad > Others.
  2. Copy/paste the following AppleScript into the Script Editor and click the compile (hammer) icon.
  3. If you run it from the Script Editor use control+command+R, but the goal is to save as a droplet on your Desktop
  4. You want to save the AppleScript source first:
    1. File menu > Save
    2. File Format: Text
    3. Save as: webloc_scroll.applescript on your Desktop or other folder
    4. Save
  5. Now, save it as a droplet to your Desktop
    1. Option + File menu > Save As…
    2. File Format: Application
    3. Save as: webloc_scroll.app
    4. Options: None
    5. Save
  6. Quit Script Editor


When you first drop a .webloc on this droplet, you will receive a dialog like the following. Click OK.


Code to copy/paste into Script Editor:


(*
  webloc_droplet.applescript
  
  Drag and drop .webloc file onto this droplet and receive a scrollable URL in an alert
  Tested: macOS 11.4
  VikingOSX, 2021-07-02, Apple Support Communities, no warranties/support implied.
*)

use framework "Cocoa"
use AppleScript version "2.4" -- Yosemite or later
use scripting additions

property ca : current application
property FLT_MAX : 1.0E+37
property app_icon : "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns"

property extension_list : {".webloc"}
property typeIDs_list : {"com.apple.web-internet-location"}

on open these_items
	tell application "Finder"
		repeat with afile in these_items
			if afile's kind is "Web internet location" then
				set theLocation to (afile's location) as text
				my show_URL_path(theLocation)
			else
				log "NOOP" -- ignore items that are not .webloc
			end if
		end repeat
	end tell
end open
return

on show_URL_path(aURL)
	
	set fg to ca's NSColor's textColor()
	set bg to ca's NSColor's textBackgroundColor()
	set alertIcon to ca's NSImage's alloc()'s initByReferencingFile:app_icon
	
	set attrsDict to ca's NSDictionary's dictionaryWithObjects:{ca's NSFont's boldSystemFontOfSize:16.0, fg, bg} forKeys:{ca's NSFontAttributeName, ca's NSForegroundColorAttributeName, ca's NSBackgroundColorAttributeName}
	
	set aStr to ca's NSAttributedString's alloc()'s initWithString:aURL attributes:attrsDict
	set frame to ca's NSMakeRect(0, 0, 310, 36)
	set myalert to ca's NSAlert's alloc()'s init()
	set scrollview to ca's NSScrollView's alloc()'s initWithFrame:(ca's NSMakeRect(0, 0, 310, 36))
	set contentSize to scrollview's contentSize()
	
	set theTextView to ca's NSTextView's alloc()'s initWithFrame:(ca's NSMakeRect(0, 0, contentSize's width(), contentSize's height()))
	
	tell theTextView
		its setMinSize:(ca's NSMakeSize(0.0, contentSize's height()))
		its setMaxSize:(ca's NSMakeSize(FLT_MAX, FLT_MAX))
		set layoutSize to its maxSize()
		its setVerticallyResizable:false
		its setHorizontallyResizable:true
		its setAutoresizingMask:(2 as integer) -- NSViewWidthSizable
		its (textContainer()'s setWidthTracksTextView:false)
		its (textContainer()'s setContainerSize:layoutSize)
		its (textStorage()'s setAttributedString:aStr)
		its setEditable:false
		
	end tell
	
	tell scrollview
		its setBorderType:(ca's NSNoBorder)
		its setHasVerticalScroller:false
		its setHasHorizontalScroller:true
		its setAutohidesScrollers:true
		its setDrawsBackground:true
		its setBackgroundColor:(ca's NSColor's clearColor())
		its setAutoresizingMask:(18 as integer) -- NSViewWidthSizable | NSViewHeightSizable
		its (contentView()'s addSubview:theTextView)
		its (contentView's setFrame:(ca's NSMakeRect(0, 0, 310, 36)))
		its setDocumentView:theTextView
	end tell
	
	tell myalert
		its setMessageText:"Selected Webloc URL String"
		its setIcon:alertIcon
		its setInformativeText:""
		its setAlertStyle:(ca's NSInformationalAlertStyle)
		its setAccessoryView:scrollview
	end tell
	
	set button to myalert's runModal()
	
	# theTextView's release()
	# scrollview's release()
	# myalert's release()
	
end show_URL_path


Jul 2, 2021 4:33 PM in response to jeff.swims

Windows uses text Internet Shortcut format documents that end in .url and are organized similar to Windows .ini files with different sections whose content has special meaning solely to File Explorer. On macOS, the binary .webloc files contain a URL key and their data item is the hyperlink to the original site. There is no integrated Finder interface to these documents.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can I see the address of a website in finder; like when in windows file explorer, right click on website name and properties to see the website address?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.