Removed duplicate code
Allow to pass script in place of url (undocumented)