Mojave OS and .webloc

Still using Mojave. I tried to create a new .webloc file but drag-and-drop doesn't work (either to desktop or other folder). I also tried copying script from an existing .webloc (these do still work) but TextEdit won't permit saving with the .webloc extension. I assume these are security measures. I also don't find Script Editor among my applications. I do this infrequently so I don't mind scripting (though I haven't used Apple Script) but I'd appreciate any answer that tells me like I'm a noob.

MacBook Pro 15″, macOS 10.14

Posted on Dec 7, 2022 11:24 AM

Reply

Similar questions

2 replies

Dec 8, 2022 2:53 PM in response to hat_full_of_why

Here are a couple of AppleScript solutions for dealing with webloc.


  1. Tell the browser to pop a save dialog where you give the webloc a name and save.
  2. An AppleScript droplet (application) where you drag and drop a .webloc onto the app icon and a scrollable dialog will appear with the .webloc URL. You can right-click on that displayed URL and choose open link.


The first script is copy/pasted from here into the open Script Editor, and then saved as a script, script bundle, or application. When you have a Safari browser open to a website that you wish to save as a .webloc, you run this script.


-- Save Webloc File as… v.1.0
-- Script by Lisa Thompson, lthompson.22@mac.com
-- <http://homepage.mac.com/lthompson.22/applescript/forcamino.html>

-- For use with Safari in Mac OS 10.5 or 10.6. Also works on Ventura 13.0.1.

-- Install at the path ~/Library/Scripts/Applications/Safari, where ~ represents the home folder,
-- creating any subfolders that don't already exist.

-- Saves the URL from the current Safari tab as a .webloc file, prompting for name and location
-- in a standard open/save dialog.

-- Source: http://forums.mozillazine.org/viewtopic.php?f=12&t=2030915&start=15

tell application "Safari"
	
	set tURL to (URL of front document) as text
	if (tURL = "") then
		set alertMsg1 to "There is no Safari web page available."
		display alert alertMsg1 message "" as informational buttons {"OK"} default button 1
		return
	end if
	set tTitle to (name of front document) as text
	set tTitle to my replaceChars(tTitle, ":", "-")
	
	set tPrompt to "Save .webloc file as..."
	set uFilePath to (choose file name with prompt tPrompt default name tTitle) as text
	
	set oldDelim to AppleScript's text item delimiters
	set AppleScript's text item delimiters to ":"
	set tFileName to (last text item of uFilePath)
	set tParentPath to (((text items 1 through ((count text items of uFilePath) - 1) of uFilePath) as text) & ":")
	set AppleScript's text item delimiters to oldDelim
	
	tell application "Finder" to make new internet location file to tURL at tParentPath with properties {name:tFileName}
	
end tell

on replaceChars(srcText, oldChars, newChars)
	if (srcText = "") or (oldChars = "") then return srcText
	set oldDelim to AppleScript's text item delimiters
	set AppleScript's text item delimiters to oldChars
	set tList to (every text item of srcText)
	set AppleScript's text item delimiters to newChars
	set srcText to (tList as text)
	set AppleScript's text item delimiters to oldDelim
	return srcText
end replaceChars


The second script which is saved as an AppleScript application (droplet) to your Desktop and allows you to drag and drop a .webloc file onto it and it will display the URL as shown below:



The code for this is at How can I see the address of a website in… - Apple Community



Dec 7, 2022 8:30 PM in response to hat_full_of_why

Hello, Script Editors is in Applications>Utilities/


Works fine here in Mojave...



Start with this if IntelMac...


Safe Boot, (holding Shift key down at startup), does the problem occur in Safe Mode? Could take 10 minutes or more.


Safe mode attempts to repair Disks & clears lots of caches & loads safe Drivers, & prevents loading of 3rd party extensions, so if Safe Mode works try again in regular boot.

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.

Mojave OS and .webloc

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