I'm trying to use socket.io for the browser. The problem is that I have no idea how to get it.
I'm following this tutorial (http://buildnewgames.com/real-time-multiplayer/) and there, they use <script src="/socket.io/socket.io.js"></script>. The problem is that this file doesn't exist and on the webiste of sockeit.io, there's no download for it.
Related
I've created a website that uses 'http://code.jquery.com/jquery-latest.js' for some javascript animations. I've hosted my website on AWS S3, but it seems like the animations aren't working. I believe it has something to do with CORS and allowing it use the jquery link, but I may be wrong. Any advice? Sorry if I'm not using the terms correctly, am just learning all of this. Please let me know if theres more information required to answer, I'll gladly update the question with it.
I have this statement at the end of my html code.
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script src="assets/js/nav-main.js"></script>
Maybe your AWS S3 doesn't have access/permission to every link/Web from server, due to which jquery is not loaded. Download jquery file Download jquery and try using this downloaded file in code.
I'm trying to run an HTML file with JavaScript inside of it. In the JavaScript I'm trying to run is a program called wget. It downloads information from a website. I used it on CMD and in a batch file to get data from an xml that is hosted locally on my computer. Now I am trying to run wget so it runs from an HTML file. (the panel.html for the twitch panel extension), however I have been having a time just making the thing run.
I have been fiddling around, and the issue I now face is when I try to run the HTML in Chrome web browser the inspector says, Module name "wget" has not been loaded yet for context.
Screenshots:
HTML:
Error from Chrome:
(Click image to enlarge)
Installed wget from cmd:
I tried to read this for hours, and I don't understand it at all. In fact I don't think the issue in the link is the same issue as mine, but this is what every search keeps coming up with. I don't understand the whole dynamic thing or why they are even using the word "dynamic" for. It just seems like they can't use require because it doesn't work against paths, however I am not trying to define a path. I just want wget to work from this HTML file. I'm annoyed that I can't find anything on this exact problem. Every problem I have seen like this doesn't have a basic example of var wget = require('wget');
I just need what's in my JavaScript or HTML script tag to work.
I downloaded the require.js file and put it into the HTML as a script tag. From here it should just work. I already downloaded wget from cmd so it's on the computer somewhere. I also put the .exe in the same folder as the .html and the require.js.
Also I read somewhere that another reason this doesn't work is because wget is "loaded" or something like that. In that case can someone tell me how to "load" wget into the HTML or JavaScript first so that this error goes away? The basic wget example I found online is:
Here is the HTML file:
I'm not using a path, I just want wget to work from JavaScript. The wget example shows that it uses require. If I don't need require then please provide an example of how I can use wget in JavaScript without require or how to make this error go away.
I've been trying to figure out the best way to get the status information from my VLC player and put it into an HTML file so I can use that as a Twitch extension on my Twitch channel. VLC media player has a status.xml when you run it as a http server. I can only access the localhost:8080/requests/status.xml from a browser because it has basic authentication where I have to put in my user name, so I use wget to put in my password and download the status.xml back to my computer as another copy that isn't setup with authenitcation. Then I can use that download status.xml's information to post what music is playing on my VLC player. The problem is I need wget to pull the information from the localhost:8080/requests/status.xml file from the html file so that whenever its ran, the status.xml gets update with the new information and this the html will post the most current thing playing on my VLC player.
Since phantomjs is abandoned, I would like to know if there is any alternative method. e.g. chrome-webdriver wouldn't be a good solution as it wouldn't be able to run on a remote host such as heroku.
So, is it somehow possible to scrape an external website that require javascript being triggered first? Note that it should be possible to run it from a nodejs application.
I was getting ready to put together something for you, then I thought better and google'd it. Check out this build script; it seems to answer your question exactly.
https://github.com/stomita/heroku-buildpack-phantomjs
Set up a git branch and pull it locally if you have to, but this should work. Basically, you need to download the binary and then remote in and run "heroku run 'phantomjs'" or "heroku run 'bin/phantomjs'"
I apologize in advance if this question is not appropriate for this forum. I could not find answers from searches in Google or Stackexchange. Also, because the question was specific, I thought I might be acceptable.
Background:
The end purpose is to troubleshoot a server connection error where a client machine runs javascript. I'm trying to at least determine the source and destination network ports used for the communication attempt.
I know zero javascript but have some background in C++.
The client runs this html page:
<script type="text/javascript" language="javascript" src="com.vmware.vim.cimmonitor.gwt.CimUi.nocache.js"></script>
Is there a way to view the contents of the specific js file? I cannot tell if the js file is bundled locally in some kind of javascript library or resides somewhere in vmware.com
I've tried to directly enter the full js name into firefox, but got a server not found error.
Thanks.
Press F-12 to open the browser's debugger. Open the NETWORK section. Reload the page. It will show you a complete list of resources as they are loaded. You can click on any of these to look at the source and http header information.
Unless the js code is using websockets, communication is likely just http:// on port 80.
if you use the developer console in chrome/safari, you can view all loaded javascript in the resources tab.
you can also use netstat to see what active port connections you have.
In order to use jQuery, do I have to use the following reference in my html?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
What if my server does not have an internet connection?
Use this code:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">window.jQuery || document.write('<script src="/res/jQuery/jquery-1.7.1.min.js"> \x3C/script>');</script>
This will try to download from the CDN, or otherwise use the local one. You must download the local one first though.
It will not work if you don't have internet connection.
To work locally you should copy jquery.js to your local directory and give relative path.
<script src="/jquery/1.5/jquery.min.js"></script>
It is not specifically for this case, but I think you should definitely understand how Client-server works. Also, you should understand what is Client-side scripting.
You would then understand that you (your browser) need to be connected to Internet in order to be able to reach the http://ajax.googleapis.com domain.
If you want to work with it locally, without ever reaching Internet, then download jQuery locally, and refer to it in your script tag.
Download the latest jquery file:
http://code.jquery.com/jquery-1.7.1.min.js
And save it to you project. It will now be available locally so you can reference it like this (only an example):
<script src="/path-to-your-jquery-file.js"></script>
It does not matter if your server has or has not connection to internet. Only the browser which tries to access page from said server need connection to internet. Server just needs to be "visible" from this browser in question.
It might be better, if you understood the basics of how internet works, before you start playing in developers.