Use Vscode for the first time. Use ctrl + f5 to run code. It opens up a chrome window and get hit with a
This site can’t be reachedlocalhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
What to do?
You're probably not running a server correctly. But if you are, that probably means you have a problem in your configuration.
If you just want to run a document that is located on your computer, Chrome will run it just fine if you put the file path in your address bar.
(I had a problem just like this when I was just getting started with HTML, CSS, JS. It is also important to note, if you are also just starting out, that the file path will need to point to an HTML document, not a JS. JavaScript normally cannot be rendered on its own.)
Related
I generate chrome trace files and with to open them non interactively from a script. However, I do not want to use the default chrome://tracing page, instead I use https://ui.perfetto.dev which I find much more convenient.
The only problem is that it is an interactive process - I need to open the file dialog and select the trace file from there, then the traces in that file are displayed. There is no network traffic here, purely Javascript.
But maybe there is another way to open trace files in https://ui.perfetto.dev that can be scripted? Or maybe there is another site that gives the same kind of GUI, but also satisfies my requirement?
By scripting I mean I want to run a script with a trace file and as a result the default browser opens with the tracing page.
Look at what tools/record_android_trace does here:
https://github.com/google/perfetto/blob/master/tools/record_android_trace#L345
Essentially you can achieve that by:
Serving the file over HTTP (it MUST be port 9001 to satisfy ui.perfetto.dev Content Security Oolicy)
Open https://ui.perfetto.dev/#!/?url=http://127.0.0.1:9001/file.trace
The url= argument will cause the UI code to automatically fetch the trace from your local web server. You can kill it soon after the GET request is done.
So everytime I run a test with testcafe, in the URL I tend to get something like http://10.0.75.1:11111/randomCharacters/ThenActualURLHere
is there a way where it just goes to the actual URL I want it to navigate to without the localhost at the start of the URL?
As I've got an issue, the screen I'm attempting to get to is an iFrame with an angular app within the iFrame, however whenever I navigate to the screen, the iFrame is not loading and I get a js error within the console tab of dev tools stating: "failed to load module script the server responded with a non-javascript mime type of text/html. Strict MIME type checking is enforced for module scripts per HTML spec"
However when I'm manually navigating to the screen (without the localhost in the URL) the iFrame loads fine without any js errors.
Thanks
No, it's not possible since TestCafe uses a URL-rewriting proxy which allows it to work without the WebDriver. It looks like you found an error. If you can create an example that can be run locally, please create an issue in the TestCafe repository - https://github.com/DevExpress/testcafe/issues/new?template=bug-report.md.
I use a number of CDN links in my webapplication for javascript and CSS, e.g.:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"
integrity="sha384-I6F5OKECLVtK/BL+8iSLDEHowSAfUo76ZL9+kGAgTRdiByINKJaqTPH/QVNS1VDb"
crossorigin="anonymous"></script>
Usually everything works fine, but sometimes I get this message in Firebug console:
None of the "sha256" hashes in the integrity attribute match the content of the subresource.
If that happens, my javascript doesn't load and my application is broken. A simple refresh will resolve that. Rather than getting rid of the CDN links and hosting the files myself, I would like to fix this. Is this a common problem?
One possible explanation for this is if your system time is sufficiently off. I was running Debian in a VirtualBox instance. I hibernated the host machine a few times without touching the VM again. That's when I noticed certain Web pages weren't loading properly in Firefox within the VM. Once I got here it occurred to me to check the system time. Sure enough it was off by nearly 2 hours. ntp was not installed so I installed that package: sudo aptitude install ntp. I verified that the date/time was updated with date, and then tested Firefox again. The problematic Web pages (including this one) worked.
Make sure your network connection is working or if you have your browser set up to use Network Proxy that it too is working.
I was seeing this message as I was loading html locally (e.g., File -> Open File) on a browser where the integrity check would fail because I did not have the network proxy (via ssh tunnel) working at the time. As soon as I resolved my network connectivity, the page would load and these messages would go away (with the assumption, of course, that the integrity attribute values are correct.)
I've noticed that some simple scripts in JavaScript that work perfectly on my local server don't work at all online.
How can be this possible? JS client-side scripting? Any ideas?
Sorry for not providing much information, and for my English, too.
Mine was a general question.
For example:
$('#posticipa').click(function(){
var stato = $('#future').css('display');
if(stato == 'none'){$('#future').css('display', 'block');}
else{ $('#future').css('display', 'none');}
});
This piece of code works perfectly on my local Apache server on Ubuntu 9.10, with Firefox 3.6, 3.5, Google chrome and Opera.
When I upload it on my remote CentOS server, also running Apache, it doesn't work. No errors are displayed in Firebug or the console; it just doesn't run.
I'm using the same version of jQuery on both servers.
Check console in your browser for errors. If it is Firefox - install firebug, if it chrome - press Ctrl + Alt + J.
It depends on what your script is trying to do. "Any ideas?" is pretty broad. But client-side scripting has a lot more restrictions than server-side, for obvious security reasons. For example, if you could access the client's file system through client-side JS, any website on the internet would be able to take control of your system.
JavaScript Security Restrictions
Having looked at your edited question, I think it's most likely that one of two things is happening:
Some kind of error is causing the JS to fail before this code is hit (but you say FireBug isn't displaying an error, so if you've got FB set up right this shouldn't be the problem)
The entire script is never getting hit, probably due to an incorrect src attribute in the script tag.
Try putting a debugger; line or an alert somewhere very early in your JS code. That should tell you whether the script is getting hit (the debugger command should tell FireBug to go into debug mode, provided you have FB's Script tag enabled on when you load the page).
If it isn't getting hit, make sure the script's src is the correct, reachable URL. If it is, move the line steadily down your code until it doesn't fire anymore. That should help you figure out where the error is.
Ok so I'm lost here, frustrated and pulling my hair and out. Plus probably about to be fired or take a pay cut.
I moved Files from a development server to my local machine. The files are consistent (used diff tool), all the dependencies are there. It works for the most part. The problem is that the some of the javascript (not all) is just not working. We're using jquery and a lot of plugins for it. I've checked with the web developer plugin in firefox and all the js files are loading. I cleared the cache in both firefox and chrome multiple times to no avail. The development server is a windows server running wamp. My local machine is running ubuntu. Somebody tell me what I missed.
Download firebug as a Firefox extension and view the http request and responses.
Easiest may be from within the 'net' tab to determine if your script is making a request.
Very likely that it is a source domain issue. There are no work-around for this issue. The ajax request and the source data must be on the same domain.
It may have something to do with JavaScript's security limitations. (In certain circumstances) You can only operate on URLs or pages from the current domain, which most likely changed when you moved the files off the other server. More here.
Are you running the files via a webserver, or just opening the files directly? If it's the latter, you'll want to set up a server on your local machine for local testing, and serve the files using it. Otherwise, you'll very likely run into the domain restrictions others have mentioned above.
You may need to host the site using a local server. VS IDE has an add-on called live server. You need to set up a workspace in order for it to work. The port used on my machine was 5500.
You need to make sure any dependencies for javascript are running on your server or the javascript will not be executed. These dependencies are listed in the json file.
ex. If you require express, you need to be running node or the javascript won't execute in your web browser.
In the terminal:
node app.js
Any dependencies that are not installed and running on the server will not execute.
Are you accessing the html web pages through the webserver and not simply double clicking the file to open it?
Also if you have WebDeveloper toolbar installed the click "Disable", "Disable Javascript" and make sure "All Javascript" isn't ticked.