Hi,
I don't know much about coding, so sorry if this is something stupid!
I currently have a Pinterest bookmarklet in my bookmarks bar which runs this code when clicked:
	
	
	
		
I want to move it to the toolbar, so I have made an extension with the code:
	
	
	
		
The bookmarklet works fine when clicked, but the extension gives the error "Safari can't use javascript for this action". Anyone know what's wrong?
	
		
			
		
		
	
				
			I don't know much about coding, so sorry if this is something stupid!
I currently have a Pinterest bookmarklet in my bookmarks bar which runs this code when clicked:
		Code:
	
	javascript:void((function(d)%7Bvar%20e=d.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','//assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);d.body.appendChild(e)%7D)(document));
	I want to move it to the toolbar, so I have made an extension with the code:
		Code:
	
	<!DOCTYPE html>
<html>
<head>
	<title>Pin It!</title>
	<script type="text/javascript" charset="utf-8">
function performCommand(event)
{
    if (event.command === "pinit") {
    var rUrl = "javascript:void((function(d)%7Bvar%20e=d.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','//assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);d.body.appendChild(e)%7D)(document));";
    safari.application.activeBrowserWindow.activeTab.url = rUrl;       
 }
}
safari.application.addEventListener("command", performCommand, true);
</script>
</head>
<body>
</body>
</html>
	The bookmarklet works fine when clicked, but the extension gives the error "Safari can't use javascript for this action". Anyone know what's wrong?