How would I find this file if it didn't has breackpoint in it? Filename is axios-setToken.js and it is displayed in top tab, but not in navigator.
If you press Ctrl+P and start typing the filename, devtools should find the file and list it below; clicking it opens it. I use that often when files aren't listed in the navigation pane for whatever reason.
You see a message about this when there are no open editors:
Here for instance I've opened devtools on this SO page, opened a file (just to show that Ctrl+P works even when there's already an editor open), and typed the first three letters of "jQuery" since I know SO uses jQuery:
As you can see, it found jquery.min.js for me.
This is often handy even when files are listed in the navigator.
Related
For my project I need the users to be able to select a file from his PC.
Every user has his own path, and I must open the Select File Dialog ( Input type="file" ) on his path by default, so they can dirrectly pick the file without the need to search for the directory. By default when you open the Select File Dialog, it opens on a default location , example, Desktop / Downloads, and the next time you open it, on the last time you selected an item.
My question is, how can I archive this?
How can i specify the default Path?
It dosnt matter if you open the page from a Mac or Phone or whatever.
It dosnt need to be a html Input, it could be in JS, JQuery ...
I read that by security reasons you can't, and it seems legit but i found like for mozilla you can https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Tutorial/Open_and_Save_Dialogs
Dunno if this could be archived on other navigators as Chrome or IE.
If anyone has archived it, could you pass me some URLs or code plz?
Thx in advance
No, you cannot do that. it's against the rules. Your "firefox" link refers to extensions, not pages. It would be a security issue to allow scripts to get any information about your computer's directory structure. If the open had an error callback for example, a script could guess user names in the background and try to open a folder for each of them until it no longer failed.
I am trying to debug a web page in Firefox v42.0 Windows 10, where that web page goes through a proxy server and has code injected into it inline via <script>...</script> (not including a separate .js file) by the proxy server. When I right-click View Page Source, I see the original page plus the code I expect to see injected (and which is actually running). I also see the injected content in the DOM view of the Inspector tab. And it is also visible in the Network Tab in the Response section. However, when I view the same page in the debugger, the injected code is not visible, as if the page were not running through the proxy server.
Furthermore, if I insert a debugger; statement in the injected code, I do hit the breakpoint, but in the Firefox debugger tab it tells me I'm on line 550 of a file with only 173 lines in it according to Firefox. So I can not step through the code.
When I do the same thing in Chrome, I see what I'm expecting, which is the injected code in my page, and I am able to debug this code without problem.
I have cleared my cache to no effect. I looked at the Network tab and everything looks as expected there.
How and why is Firefox not showing me the actual page in the debugger tab (matching what's in View Source or the DOM view), and not letting me step through the injected code?
There are a few bugs in Firefox that can cause this that I've encountered myself:
A local caching issue which can be solved by first closing the dev tools window, hard-reloading the page (Ctrl/Cmd + Shift + R), then opening the debugger again.
Trying to debug a tab in a container, but the source is showing the page as it would be outside a container. See bug 1375036). This particular case should now be fixed.
Similar to the previous point, the debugger source showing you a slighty/completely different document to the one that's actually currently rendered by the browser. This is due to the fact that the debugger does not have access to the original markup & inline script the browser used to render the current page! Apparently designed that way to be memory efficient, but seems to ignore the fact that a developer wants to use the memory for storing the source, because they want the actual source. See bugs such as 1060732, 1149835, and 1472581.
If this is happening to you try debugging in the default/no container, or just do it in Chrome 🙁. If you can't debug in another browser, at least try a fresh profile before you "refresh" (nuke) Firefox as others suggest. You can do this from the about:profiles page (address must be typed manually or bookmarked), or by opening Firefox with the -P flag and creating a new one. To use those flags, run firefox -P --no-remote from a *nix/Mac terminal or C:\Program Files\Firefox Developer Edition\firefox.exe -P --no-remote from the Windows Run dialogue; the --no-remote flag is not required but allows you to run the new profile alongside your main one, and disregard links clicked in other programs.
The below worked for me
Copy url from address bar and close the tab.
Open the url in private mode, the debugger shows the source.
Close private window and open in default mode, the debugger shows the source now.
Try to refresh Firefox:
"Refresh Firefox
Click the menu button and then click help.
From the Help menu choose Troubleshooting Information.
Click the Refresh Firefox button in the upper-right corner of the Troubleshooting Information page.
To continue, click Refresh Firefox in the confirmation window that opens.
Firefox will close to refresh itself. When finished, a window will list your imported information. Click Finish and Firefox will open."
Check this for more information:
https://support.mozilla.org/en-US/kb/refresh-firefox-reset-add-ons-and-settings
I had the same problem. I solved it following these instructions.
I had a similar issue, but this was due to the index page redirecting to a subdirectory. The subdirectory contained the index.html with the javascript include files. The src files only got displayed only when an error occurred. To get around this, I cleared all my cache and I went directly to the subdirectory.
There are many JavaScript include files in my page. I need to find the location of the JavaScript function named "addIndustryBtnClick(this)". I did the following steps:
Opened Dev Tool in Chrome
Selected "Sources" on top.
Selected "Sources" from left window.
Clicked on the directory name of the project.
Now I can see the page source on the middle window.
I have searched the function name and it is highlighted with yellow color.
Here is the screen shot of the current window:
I have searched on each JavaScript include files on the left window and I could find the function definition. But is it possible to find function definition without going to each JavaScript file?
If you want to search through a series of files for a specific
JavaScript function without manually digging through each file, you
can do that by selecting the tab on the lower console and running
your search there.
When I right click on the icon for my extension-in-development and click Inspect Popup (or when I click the icon and choose "Inspect Element") and look under the "Sources" tab, my .js file is nowhere to be seen - only a long list of inspect-able files like apitest, devtools, json_schema, etc. I can, however, find the code through the Elements tab by following the link in the .html file, but that doesn't bring to anywhere where I can actual debugging.
I've also loaded the "Hello, world" extension that Google's tutorial provides, and when I Inspect that one, its .js file is right there. I can't imagine what I've done differently from the tutorial example to cause this.
It's Chrome version 22.0.1229.94 run in a Linux VM. If there's any more information I should be providing, please let me know.
Type location.reload(true) in the console.
http://developer.chrome.com/extensions/tut_debugging.html
If I understand your question right,
Under the sources tab, there are two more tabs, one says Sources and the other says Content scripts. You need to click on the content scripts tab, and there you will find what you are looking for.
Okay So I figured it out, simply click on you extension icon, and a little dialog will pop up, then right click on it and click on inspect element. You can figure it out from there I reckon. (My other answer would be good if it was a content script, but this is a popup script.)
How do I "dynamically" edit JavaScript code in the Chrome debugger? It's not for me, so I don't have access to the source file. I want to edit code and see what effects they have on the page, in this case stopping an animation from queuing up a bunch of times.
I came across this today, when I was playing around with someone else's website.
I realized I could attach a break-point in the debugger to some line of code before what I wanted to dynamically edit. And since break-points stay even after a reload of the page, I was able to edit the changes I wanted while paused at break-point and then continued to let the page load.
So as a quick work around, and if it works with your situation:
Add a break-point at an earlier point in the script
Reload page
Edit your changes into the code
CTRL + s (save changes)
Unpause the debugger
You can use the built-in JavaScript debugger in Chrome Developer Tools under the "Scripts" tab (in later versions it's the "Sources" tab), but changes you apply to the code are expressed only at the time when execution passes through them. That means changes to the code that is not running after the page loads will not have an effect. Unlike e.g. changes to the code residing in the mouseover handlers, which you can test on the fly.
There is a video from Google I/O 2010 event introducing other capabilities of Chrome Developer Tools.
You can use "Overrides" in Chrome to persist javascript changes between page loads, even where you aren't hosting the original source.
Create a folder under Developer Tools > Sources > Overrides
Chrome will ask for permission to the folder, click Allow
Edit the file in Sources>Page then save (ctrl-s). A purple dot will indicate the file is saved locally.
This is what you are looking for:
1.- Navigate to the Source tab and open the javascript file
2.- Edit the file, right-click it and a menu will appear: click Save and save it locally.
In order to view the diff or revert your changes, right-click and select the option Local Modifications... from the menu. You will see your changes diff with respect to the original file if you expand the timestamp shown.
More detailed info here: http://www.sitepoint.com/edit-source-files-in-chrome/
Chrome Overrides
Open the JS file in the sources panel.
Right Click on script src URL > Reveal in Sources panel
Make sure "Enable Local Overrides" is checked.
Right Click anywhere in the JS file > Save for overrides
All Set!
Just edit the file, and save with CMD/CTRL + S. Now whenever you refresh the page, it'll use the modified file. (As long as the filename remains the same)
You'll know it's working if you see a purple dot in the file icon.
Place a breakpoint
Right click on the breakpoint and select 'Edit breakpoint'
Insert your code. Use SHIFT+ENTER to create a new line.
Pretty easy, go to the 'scripts' tab. And select the source file you want and double-click any line to edit it.
If its javascript that runs on a button click, then making the change under Sources>Sources (in the developer tools in chrome ) and pressing Ctrl +S to save, is enough. I do this all the time.
If you refresh the page, your javascript changes would be gone, but chrome will still remember your break points.
As this is quite popular question that deals with live-editing of JS, I want to point out another useful option. As described by svjacob in his answer:
I realized I could attach a break-point in the debugger to some line of code before what I wanted to dynamically edit. And since break-points stay even after a reload of the page, I was able to edit the changes I wanted while paused at break-point and then continued to let the page load.
The above solution didn't work for me for quite large JS (webpack bundle - 3.21MB minified version, 130k lines of code in prettified version) - chrome crashed and asked for page reloading which reverted any saved changes. The way to go in this case was Fiddler where you can set AutoRespond option to replace any remote resource with any local file from your computer - see this SO question for details.
In my case I also had to add CORS headers to fiddler to successfully mock response.
Now google chrome has introduce new feature. By Using this feature You can edit you code in chrome browse. (Permanent change on code location)
For that Press F12 --> Source Tab -- (right side) --> File System - in that please select your location of code. and then chrome browser will ask you permission and after that code will be sink with green color. and you can modify your code and it will also reflect on you code location (It means it will Permanent change)
Thanks
Just like #mark 's answer, we can create a Snippets in Chrome DevTools, to override the default JavaScript. Finally, we can see what effects they have on the page.
here's a gentle introduction to the js debugger in chrome that i wrote. Maybe it will help others looking for info on this: http://meeech.amihod.com/getting-started-with-javascript-debugging-in-chrome/
you can edit the javascrpit files dynamically in the Chrome debugger, under the Sources tab, however your changes will be lost if you refresh the page, to pause page loading before doing your changes, you will need to set a break point then reload the page and edit your changes and finally unpause the debugger to see your changes take effect.
I was looking for a way to change the script and debug that new script. Way I managed to do that is:
Set the breakpoint in the first line of the script you want to change and debug.
Reload the page so the breakpoint is being hit
Paste your new script and set desired breakpoints in it
Ctrl+s, and the page will refresh causing that breakpoint in first line to be hit.
F8 to continue, and now your newly pasted script replaces original one as long as no redirections and reloads are made.
Chrome DevTools has a Snippets panel where you can create and edit JavaScript code as you would in an editor, and execute it.
Open DevTools, then select the Sources panel, then select the Snippets tab.
https://developers.google.com/web/tools/chrome-devtools/snippets