Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Comments on How to run a remote JavaScript file from GitHub?

Post

How to run a remote JavaScript file from GitHub?

+3
−3

I have a JavaScript file in GitHub which I typically run by copy-pasting all its data into different user script managers (USMs) on different web browsers.

I need to start executing that remote file directly from GitHub instead, because for me it's a problem to maintain two or more versions, each one for each browser (Chrome, FireFox, Edge, etc.), rather, I want to maintain just one version in GitHub and to call it from each browser's USM (each browser might have a different USM with different internal commands, compatibility and caching).

To clarify, I don't mean to sync a script from one USM account to another (as with Greasemonkey synching); I just want to call a script that is being stored on GitHub, instead storing it locally, but only with JavaScript in way totally unified for all USMs.

Update

As Alexei noted in the comment section I can use // @require command but I still seek a JavaScript approach because it will save me a deal with USM caching, syntax compatibility and possible bugs.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Clarify the actual need (8 comments)
Clarify the actual need
Alexei‭ wrote about 3 years ago

Not sure what you are asking here. Do you want to manage the user script in a single place and have it sync on multiple browsers? Greasemonkey seems to support that here.

Alexei‭ wrote about 3 years ago

This answer also shows how to trick Greasemonkey to work with the same shared location regardless of browser/machine.

deleted user wrote about 3 years ago

Thanks Alexei, this is not what I need --- I have updated the question to clarify.

Alexei‭ wrote about 3 years ago

OK. Does locally including (executing) a remote JS work for you? Check this

Skipping 1 deleted comment.

Alexei‭ wrote about 3 years ago

deleted user If you managed to make it work, please include an answer containing the solution, so that future users benefit from it. Thanks.

Skipping 1 deleted comment.

deleted user wrote about 3 years ago · edited about 3 years ago

Alexei‭x I don't believe that @require USM function is what I need because using it caused an infinite loop in google.com in Tampermonkey for some reason and it might raise compatibility issues in different USMs. Please consider to delete this thread because the main concern of improving the question has been addressed.

hkotsubo‭ wrote about 3 years ago

If I understood correctly, require seems to be the way to go. If you're getting an infinite loop, the problem probably isn't require itself, but something that the required script is doing

deleted user wrote about 3 years ago · edited about 3 years ago

hkotsubo‭ Even when the required script had only alert("hi"); the infinite loop behavior continued (until after about one hour), perhaps it's a caching matter; if required initiates cache then that's just another reason why I shouldn't use it.