Open index.html but it turns out undefined - undefined

I am a beginner of JS, I usually use live server in VS code to see if my code works properly. A weird thing happens to a project, when I run the live server, the path becomes undefined, then the website crashed. I tried to open the file from the file manager, the same situation.
My original filename: file:///D:/Desktop/trashcar/index.html
When it opens on the browser: file:///D:/Desktop/trashcar/undefined
I am not sure if I accidentally change the settings, and the unexpected thing is only in this project. I've tried to search possible cases, but it seems I am the first case. I will be thankful if someone can give me a hint on this.

Just set the pathname in your browser to file:///D:/Desktop/trashcar/index.html
You don't need a server to view static HTML.

I tried to create a new file and past the original code line by line and it fix now. I still wonder why this happens only to that file.

Related

Vs code live server Cannot get error message

I'm currently developing a simple static web page with only HTML.
I'm using tags with href to link to different pages and the VS code live server used to work when I inserted a link like page1.html it would send the browser to this page.
But I prefer to have just the page without the .html.
When I remove the .html from the link the live server gives an error: Cannot GET /page1
But when I deploy my site on Netlify it does, however, find the page, but this breaks the development process for me.
How can I fix the live server so it also gets sent to the correct page?
Thank you in advance,
Timo
This is a common server behaviour. The server tries to find a file or folder name page1 but doesn't find it. Nothing wrong with live server. I guess Netlify is the one doing extra magic.
However if you want to remove the .html in page1 you could create a folder name page1 and put inside a index.html with the content. This way the server will find the folder named page1 and return the index.html. This will also work with live server and any standard server.
This is how your folder structure could look like:
Cannot GET /source/gfdfghdgh/A/1&2.html
This is the error I get because of the '&' symbol.
Make sure your file name is browser friendly.
VS CODE LIVE SERVER CANNOT GET ERROR MESSAGE
Restart VSCode
Sometimes the best you can do is start VSCode from scratch. First, save all of your work. Then close VSCode, which will also stop all of the extensions you've installed. Then, reopen VSCode and try again – go to the HTML file you want to view, right-click## Heading ##, and select "Open with Live Server".

Brackets live preview not working

I am working on a local project (read: offline) and I am trying to get Brackets' live preview to work since it comes in handy quite often.
Right now I have opened my project files using Brackets' "open file" option since it supposedly maps the path to the source files. Although I am getting an error saying In order for Live Preview to connect, Chrome needs to be relaunched with remote debugging enabled.
I have read else where that Chrome, by default, does not need to be relaunched for that change and that Brackets force this flag by itself.
I have tried reinstalling Brackets, launching with another project and searched all over Chrome for this flag and did not find any thing.
Any tips?
This page shows you how to instal remote debugging! It's a Chrome dev tool. It's geared towards android apps for whatever reason, but I had that same error, and following the instructions on that page helped me launch the brackets page.
If that doesn't work, here are some troubleshooting tips that have helped me out with live preview:
1) Make sure your filename has a .html at the end
2) Use different browser (I've found chrome to be a bit finicky with brackets)
3) Make a different blank file, launch that, then launch the file
Open the folder, not the file, and then select the file.

Change to this file were not saved to file system error in google chrome version 30.0.1599.101 m

In the google chrome version 30.0.1599.101 m I am not able to save the changed js file.
On saving the js file I got yellow triangle symbol with "change to this file were not saved to file system" message.
I know this used to work in older version
I am using windows-7 64 bit
Click on the cog in the developer tools window (lower right corner)
Go to workspace and add the directory which you would be working on.
This is to accidentally prevent you from modifying files that you did not intend on changing.
Happened to me too. After picking the workspace directory, I also mapped the file from the "Source" panel of Devtools to its filesystem equivalent (using right-click on the file, from the file tree). It solved my problem.
In chrome > 63, accepted answer option is disabled.
In later should be done through workspaces.
Tonight, I accidentally managed to fix this problem, just open the file on the disk and save it with a simple change even with a space.
Refresh the page in Chrome, Chrome will link it(The file) to the disk.
Using Ctrl + F5 to clear the browser cache worked for me.
I found nothing in "workspace" that seemed relevant, and other things people listed didn't help either. What helped was to go in dev tools, where it says Pages, Sources etc., there is also Overrides (duh :)), I chose it, it said "Select folder for overrides", I did, and then also clicked "Allow" on Chrome asking for confirmation. That's it, after that I was able to save the files, the overrides worked.
Ok, my case might be a bit different but I will share my experience on what I was facing that caused to this warning and how I solved it.
I was trying to check a certain strange behavior on a React app for video streaming, so I opened up Developer console, enabled local overrides and tried editing the js file, immediately upon saving I got the warning “Changes to this file were not saved to file system”.
Note the message at bottom right “Source mapped from app.bundle.min.js”, this indicated that this is not an actual file but a mapping from the app.bundle.js (Webpack bundle)
So I moved to editing the app.bundle.min.js, I searched the appropriate string I was interested in from the mapped file (react-dom.production.min.js) and searched it in app.bundle.min.js
Again I got the same warning but I noticed the “app.bundle.min.js” file was fetched using a url parameter ?v=4900, I decided to remove it to check if that was the culprit causing the issue, to achieve that I modified the index.html file and edited the script tag that was fetching the js file from
<script src="libs/app.bundle.min.js?v=4900"></script> to <script src="libs/app.bundle.min.js"></script>
After that I forced refresh the page (Shift+F5, normal refresh didn’t work), tried modifying and saving and Jackpooot!! (Take away: You can’t override files fetched with a url parameter). I then was able to beautify, modify and override the app.bundle.min.js implementation and achieved what I wanted.
On Chrome Version 109~ :
Go to F12 > Sources Tab > Overrides (You may need to click the chevron next to Page)
Select/Create a folder to contain Overrides
You can now right-click a file or editor window & save it for Overrides
Image of sources tab where Overrides is located
Something to note: if you are making dynamically loaded JS available in devtools via the helpful: //# sourceURL=Example.js comment, this network to local mapping will not work.
Note: Notice the "//# sourceURL=dynamicScript.js" line at the end of dynamicScript.js file. This technique gives a name to a script created with eval, and will be discussed in more detail in the Source Maps section. Breakpoints can be set in dynamic JavaScript only if it has a user supplied name.
https://developer.chrome.com/devtools/docs/javascript-debugging
When you're using sourceURL, you can't actually find the respective JS file in the Sources tree where you might expect it to exist. It is available to open via the "no-domain" tree, however (or quick open with CTRL/CMD+P).
I'm still looking for a solution.
The easiest solution I found to this problem:
(keep in mind, I was manipulating an html page that lives on my machine)
open the associated html page from the command line so the page displays
for mac, that's simply $ open <name>.html
open Dev Tools
open Sources tab
in Page, open a new .js file there with whatever name you need
write in some text and save
This worked for me. Yes, I had to create a new .js file, but my directory locally recognized it was there when I pulled it, and my editor was updating in real time with the dev tools each time I saved either. At that point, my editor and the dev tools source tab had become one thing.
Currently on Chrome 100.0.4896.60 (Official Build) (x86_64).
I've got a js file with source maps; the override has always been spotted.
I'm able to override the map file (which won't work though for the debugging purpose) and the index.html file.
Apparently my issue is related to minified js with source maps.
Seem to work in relation to the chrome version installed.
I tried the following attempts but didn't work:
remove cache
disable / enable override
add the dir to the workspace
install chrome canary
To debug then I've tried:
build my file.min.js to test. In my case was production/file.min.js
start a npx http-server in production (cd production && npx http-server) which open to http://127.0.0.1
override index.html to consume http://127.0.0.1/file.min.js
Interesting considerations:
When i was doing basic overriding i had to replace the file manually all the times.
Now, I've got a watch task going on and i can basically refresh the page.
I can see as well the source map update.
It's simple! Right click on your page, Go to Inspect, go to the Network tab and tick the check box 'Disable cache'. Reload the page and you will see the effect.

Why won't this link open a file anymore?

I have a Web application that is hosted locally on Websphere. In the application there is a link to a .doc file located on a windows server.
CIT
The link was been working for years, but suddenly stopped working on all computers on the network. When I click the link, nothing happens. I checked the files path and name, and nothing has changed. The interface is viewed using IE8.
Does anyone have any clues onto why this isnt working or where I can look to resolve this?
edit: i have just noticed that the file (CIT_.doc) has been saved in the same directory, could this have an effect on it?
I'd imagine one of the following has occured:
The file has been moved or renamed
The K: drive has been re-mapped or other wise modified to a different location
A popup blocker is tampering with the link (because target="_blank")
In other words you need to manually check that file location within explorer, you also need to try a different browser.
Also you need to change the link to:
CIT
See here for the reason, you may also need to URLEncode it.
It probably has something to do with security settings that your network administrator has recently setup, seeing as the m.edmondson's answer does not work. Try it in another browser besides IE.

URL opening error in Flash CS4

I have a script that loads a php page for variables. There are no problems when the swf is uploaded to the site but when I run it locally, I keep getting "Error opening URL" messages. I'm using absolute pathing and if I paste the URL my script is using in a browser, the correct page opens. This only started happening after the site changed servers. Any ideas what the problem could be? Thanks.
The "Error opening URL" seems to be caused by a number of issues. I have tried to keep track of all the different solutions I have used in the past to fix the problem. Ever time I encounter the "Error opening URL" the solution is different. Hopefully one of these solutions helps you.
I usually find the following solutions on google.
- Make sure crossdomain policy is setup correctly.
- Set a bunch of variables like Security.allowDomain(domainHERE)
- Change publishing setting for your flash file.
- Make sure your connecting to the right url.
Here is what works for me... usually.
1) Make sure you are connecting to the right URL.
Use the full path, don't use relative links. Also, copy and paste the url in your web browser to see if it connects.
You can also use flash.events.HTTPStatusEvent.HTTP_STATUS to view the HTTP headers but I would recommend you check out solution 5 first. Its a much easier way with more details.
Source: http://www.judahfrangipane.com/blog/2007/02/15/error-2032-stream-error/
2) Put a crossdomain.xml file in the root of your server (usually public_html or www)
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
Source:
http://www.senocular.com/pub/adobe/crossdomain/policyfiles.html
3) While editing the flash file, press Ctrl + Shift + F12
Make sure Local playback security is set to Access Network Only.
4) If you are hosting locally using MAMP, WAMP, XAMP or something similar, skip this step. Otherwise, Call your webhost and yell at them ;)
I have hosted with godaddy, hostgator and liquidweb. It seems that all of them have some kind of firewall setup blocking flash from accessing the files you want it to.
Give your host a call, tell them your problem and ask them to whitelist the files you are trying to connect to and you should be good to go.
Remember, everytime you want to connect to a new file, it has to be whitelisted. I always forget this and it takes me 3 hours to figure out why changing the name of my file or moving it messes everything up. :)
5) Use Charles Web Debugging Proxy Program to gather some important information.
I will break this down into a few steps.
Usually for me the "Error opening URL" is due to a coding problem on the site I'm trying to connect to.
Open Charles
Run your flash file
Select the site your flash file tried to connect to in Charles side bar.
View the Response tab near the top.
On the Response tab you should see a few other tabs near the bottom. View the Headers tab.
See what HTTP_Status was returned. Then look search this page to see what that status code means. It will give a somewhat broad definition but it still helps narrow things down.
500 Means a problem with your server... If your server is running fine, then its most likely a code problem.
Then view the Text tab near the bottom of the Response tab. This will show you exactly what that webpage looks like to flash. If your server is in some kind of debug mode where it displays errors, this is where you will see them.
Well I hope this helps someone. I will try to continue to update it with more issues and solutions I run into. This is probably the number one problem I run into with flash. Super annoying!
Crossdomains.xml file possibly?
not really a solution, but a work-around:
before CTRL-ENTER on your .fla, do a CTRL-S
this seems to work about 90% of the time for me
NOTE: I never had this problem until one random day about 6 months ago. Now it plagues most of my old projects, cs4 or cs6.