Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
When I go to others' page, I want to see the Javascript code how others write.
Can I view the js code by right click and inspect (chrome) , I know html and css can be seen, but how about js code?
Open up your browser developer tools and go to the Network tab, then load a page. Select the "Type" column, and then you can examine those with a Type of script. For example, on Stack Overflow, you'll see something like:
As you can see, Stack Exchange loads jQuery, a script named stub.en.js, a script named clc.min.js, and a few more. To see what those scripts contain, either click on them in the Network tab, or right-click and select "Open in new tab" to view it as a standalone tab.
But professional sites often minify their Javascript, and complicated minified Javascript is very difficult to read. Better to read source code whenever possible, not distribution code, to save yourself a headache.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Visual Studio Code must have had an update. I wasn't able to find anything on their website but I wasn't seeing my alert I created like it used to appear on the browser page and then I noticed that the alert is at the bottom right hand of the screen outside of the browser page but inside the Visual Studio Code. Is there any way to make this show up in the browser preview using extension for Live Server?See attached screen shot - scroll to the bottom right to see the alert.
This looks like a VSCode runtime and VSCode alerts look just like that. If you run it in an actual browser it will give you a browser alert as you are used to.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm looking into chrome extensions, and I was wondering if it's possible to change a specific website to add a box and run a game on it.
I believe I can change the website, no problem. But I'm having trouble figuring out what I can use to run a game in there.
Do have in mind that I'm relatively new to web dev (but not to code).
Thanks in advance!
Yes, it is possible to manipulate pretty much anything on the website, as long as the user who installs the extension gives you permissions to inject content scripts into the page. Content scripts are the Javascript and CSS files that would contain logic for your game. Once injected, you can target a DOM element in the page and initialise your game there or even create a new element and embed it somewhere in the HTML.
This is a good place to start https://developer.chrome.com/extensions/content_scripts
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm working on a template that has various javascript files and plugins.
I want to know in witch javascript file the element get styles and in which line it has been declared
Assuming that the Javascript gets rendered: open your page in Chrome. Press F12 to open the development tools.
Click the 'search' icon at the left side of the bar, and hover your element. The "Styles" bar at the right side shows which CSS file is used to render the element.
open your template in browser.
Right click on your desired element.
Choose inspect element.
There you can find the file name in which element in written, style sheet file name and line number if it has.
Use developer console in chrome or firefox to debug and look over the javascript files and use breakpoints for checking the javascript files.
press F12 in chrome to get to developer tools and select Sources, navigate to javascript file which you need to debug.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
can my page Javascript read same page which itself is loaded? Like other parts of page are dynamically loaded by other provider. I have tried many things, google as well, but now I am in doubt that it is posible. Or it is.
Thank You!
If the page has loaded and the javascript you are running is client-side (which it should be), you should be able to access everything on the page via the document object. I would advise reading about the DOM to familiarise yourself with this.
EDIT: removed link
Server side code (whether written in JavaScript or otherwise) is not capable of determining the final rendering of the page in the user's browser.
You could build the entire page yourself (and you could use a headless browser, like PhantomJS, to do it) but that could give different results to a visitor's as you would have a different set of cookies, a different source IP address, and so on.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I know how to use JavaScript on Google Chrome's console.
But is it possible to edit JavaScript files from within Google Chrome's developer tools and see the changes immediately? If so, how?
I have tried changing the code, but it has no effect on the page.
You can edit javascript of the page. You had to make a double click in the old version of chrome or in the recent version you need to make a single click in js file. After that you need to press Ctrl+S or Cmd+S on Mac.
Then DevTools will send the changed code to V8.
If you are in a debug session and stay on a pause in a function you can edit it and after Ctrl+S v8 will move the execution point out from the edited function so you will be able to pass it again.
You could redefine a global function or change the value of a variable in scope, but I'm not aware of any way in the Chrome Dev Tools to edit your code while live. I edit, then hit refresh.
You can live edit CSS in the Sources tab.