Comments (2)
That's an excellent question, @alessandro308. I will add it to the FAQ section.
Witchcraft matches the hostname
, not the host
. As the MDN docs explain, hostname
doesn't take into account the port part.
So, in your case, you can simply create localhost.js
and it will work fine.
If you must match the port (you could be running another web server locally and you don't want to run the script there), you can check the port before running your actual script. Checking the port can be done by reading from location.port
. So you could just:
if (location.port === 63342) {
// run my script
}
You could even go one step further and create a separate file for that specific server and include it from localhost.js
, just like this:
if (location.port === 63342) {
// @include "my-intellij-web-server-script.js"
}
So that's it. I hope that solves your problem. Let me know if you need more help. For now, I'm closing this issue.
from witchcraft.
Question added to the FAQ.
from witchcraft.
Related Issues (20)
- Quick item... code example on your homepage HOT 1
- Cannot assign variables to the window or document scope? HOT 1
- Google analytics is causing couples of issues HOT 11
- The js and css modification is not being picked up by the extension without reloading the page HOT 2
- Quick question: Is it possible to match chrome extensions (i.e. options pages or the LastPass vault)? HOT 2
- question: how can I include resourse, for example: image HOT 3
- Background being unloaded by Chrome due to inactivity
- Question: Disable / unload scripts from running -- str.replace HTML before page is loaded ? HOT 2
- Cannot remove once added script even after deleting file HOT 2
- Support for glob matching HOT 3
- Wildcard support? HOT 3
- File path resolution? HOT 8
- add locally stored custom css/js HOT 1
- Files are still being cached HOT 2
- The script list has not been loaded HOT 5
- How to get a reference to the page level global scope? HOT 1
- Chrome doesnt remember the host url
- Very Basic Question
- Chrome Web Server Alternatives HOT 4
- check if scripts exist (v3 branch)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from witchcraft.