Safari Developer menu - show executed JS on event - javascript

Is there a way in the Safari Developer menu to show triggered/executed JS functions/code on events on a web page (for instance a button is clicked)?

Yes, it posible, first you have to enable the Inspect Element:
here a tutorial:
Choose Safari > Preferences, and click Advanced.
At the bottom of the pane, select the “Show Develop menu in menu bar” checkbox.
then open the Inspect Element and go to the 'Sources' tab
here you will see the Breakpoints and start play.

Related

Inspect element without right clicking in Chrome

When I inspect html/css on a website, I usually open the chrome developers panel ctrl+shift+I → right click context menu "inspect" so I can highlight that class
however, sometimes I'm trying to inspect an element that is sensitive to "right clicks" events , e.g. if I right click an item on the website functionality changes
Example:
so I can't inspect an element
Normally I inspect elements like this (e.g. stackoverflow)
How do you inspect an element without using the right click button?
Normally I would have to just dig through the chrome developer's panel elements and just go one by one to find said element, which takes a really long time
I must be missing something important here about chrome's inspect element tools.
Could someone enlighten me here a better workflow / maybe chrome extension tools?
Try pressing ctrl+shift+c. This will open the dev tools in element selection mode, allowing you to left-click on elements to jump straight to them in the elements view.
You can press Ctrl+Shift+C to enter a mode where you can mouse over elements and it will inspect it. With your mouse over the element you want to inspect, just press Ctrl+Shift+C again and your element will be selected in the developer panel.
You can open the dev tools on a different windows and refresh your page or use firebug.
or use Firefox

How to avoid Google Drive/Gmail context menu disappearance using Chrome Developer Tools

I'm trying to inspect a context menu using Chrome, like the one from Google Drive or Gmail. I do right click and then ctrl+shift+I, but the menu disapears when it loses the focus.
Anybody knows how to inspect a context menu? Or maybe, some way to keep the menu visible after losing focus?
On Drive application the contextual menu is triggered by Javascript. In order to suppress the element disappearance it's necessary to remove all the Blur listeners from the Event Listeners tab of Chrome Developer Tools attached to the element.

Debugging event when button is clicked

I'm fairly new to debugging and JavaScript in general. I want to find out when is being called when I click a button.
I click this button and a popup appears, I want to find out what is executed when I click that button and which code is triggering the popup.
How do I do this?
I am not sure what development tools you are using, but using something like Chrome Dev Tools You can record events and then show what is triggers after click events.
Open the inspector
Go to Timeline tab
Click Record
Click the button you want to debug
Stop the timeline
Investigate the Javascript (purple) events in the timeline
For deeper learning about Chrome Dev Tools, I enjoyed Code School's free class.

How to disable JavaScript in Chrome Developer Tools?

I am trying to debug the features of a website when users disable their JavaScript. I was wondering how do you disable JavaScript for a page from the Google Chrome DevTools?
Click the gear icon in the corner of the Developer Tools, click Settings, then under Debugger, check Disable Javascript, as shown in the following video:
Update August 2020
Developer Tools (F12)
Click the Gear icon
Should open the Preference tab
Disable Javascript option is on the far right
Original answer
Developer Tools (F12)
Three vertical dots in upper right
Settings
Under the "Preferences" tab on the left
There will be a "Debugger" section with the option (probably on far right)
Official documentation: Disable JavaScript With Chrome DevTools
There's now a command menu built into DevTools that makes it easier to disable JavaScript. This has been around as of April 2016 or so.
Open DevTools.
Press Command+Shift+P (Mac) or Control+Shift+P (Windows, Linux) to open the Command Menu. Make sure that your cursor's focus is on the DevTools window, not your browser viewport.
Type Disable JavaScript (or some version of that... it's a fuzzy search) and then press Enter.
Use the Enable JavaScript command when you want to turn it back on.
chrome://settings/content Javascript/Manage Exceptions
This extension makes it faster (I am the author) : Quick Javascript Switcher
It is open source: https://github.com/maximelebreton/quick-javascript-switcher
You can also run Chrome with JavaScript disabled by default by using the flag:
-disable-javascript
You would use this for example by running Chrome like this:
C:\Documents and Settings\%username%\Local Settings\Application Data\Google\Chrome" -disable-javascript
The quickest way is problably this one:
F12 to open the dev console
ctrl + shift + p to open the command tool (windows)
Type 'disable javascript' and hit enter
On OSX, I had to click the triple vertical dots, and uncheck a box in the settings section. Which can also be opened with f1
Using only the keyboard at least for Windows 10:
F12, shows Developer Tools
F1, shows Settings
tab, moves to the "Disable Javascript" check box
space, toggles the option
esc, hides Settings
The fast way:
1) just click on CTRL + SHIFT + P
2) fill the field by the 3 letters dis and will appear this box and select the item Disable Javascript
.
that's all folks!
On Mac OS X:
Preferences
Show advanced settings
Press the "content settings" button
Scroll to the "JavaScript" section
Check the checkbox in front of "Do not allow any site to run JavaScript"
The Chrome Quick JavaScript Switcher extension is a lot easier though :-)
Go to options (Windows: three vertical dots in the top right) -> Settings, or hit F1.
In the General section you find "disable JavaScript"
The gear icon is no longer part of developer tools. Since Chome 30.0 it is not even possible to bring it back (In Google Chrome Developer Tools, the toolbar icons disappeared. What gives?)
To temporarily block JavaScript on a domain :
Click on the Button left to the address on the address bar (which says View site information)
In the drop-down next to JavaScript, select Always block on this site
Reload Page
Click the ⋮ menu in the corner of the Developer Tools, click Settings
Click on Advanced at the bottom
Click on Content Settings
Click on JavaScript
Switch off
Full and fast instructions for Chrome browsers (Opera incl.)
The first way
If Developer Tools aren't open then press F12 key on keyboard to show the Developer Tools. In Opera browser you have to use key combination Ctrl + Shift + i on keyboard to open it.
To show the settings just press F1 key on keyboard. The Developer Tools window must be focused when you are doing it. Or if you want to open the settings with the mouse then you have to click on ⋮ button in the top right corner of the Developer Tools, then click Settings in the menu.
Then you have to scroll down the settings window to bottom and then you will see the checkbox for disabling JavaScript like follows:
Just click on this checkbox and push esc key on keyboard for hide the settings. If you want to enable it then you have to do the same way again.
The second way
If Developer Tools aren't open then open it like in the first way is described.
Press the key combination Ctrl + Shift + P (for Windows or Linux) or Cmd (⌘) + Shift + P (for Mac) to open the Command Menu. Be sure that the focus is on the DevTools window.
Type there "Disable JavaScript" and then press Enter or click it with the mouse. If you want to turn back the enanled JS then open the Command Menu again and type there "Enable JavaScript" and then press Enter or click it with the mouse. You could also write just only "JavaScript" or "Java" there and then choose it with the mouse.
If all this does not work
For some reason it is possible that it does not work. I this case open a new empty site in "Incognito Mode" and do all this there.
The quickest way
In Chrome Web Store or on Opera Addon site you can find and install extensions which do it per one click. Just search "Javascript Switcher":
For Chrome browser
For Opera browser
Press F8 for temporarily freezing / unfreezing JS (with DevTools open).
This is very useful for debugging UI issues on elements that may lose focus if you click or press anything outside of that element. (Chrome 71.0.3578.98, Ubuntu 18.10)
Paste it: chrome://settings/content
Go to "Javascript" section and disable it.
Chrome://chrome/settings/Privacy/Content settings/JavaScript
and there you can PASTE your website's URL in Manage exceptions.. and change the JavaScript priority from ALLOW to BLOCK.
This is the latest setting for the windows
Settings > Advanced > Privacy and security > Site Settings > Javascript > Blocked then get switch on and off
good question, i try so many way, but it is curry and boring, until i find shortcut.
alt + cmd + i, this open dev tools, unless you use pocket, that need set other shortcut.
shift + cmd + p, then input: javascript
only two shortcut, but i think safari is more convenient for that.
There's a settings in chrome
open the menu from chrome,
click settings > type in "javascript" in the search bar > click site settings > click javascript.
from here you can toggle javascript specifically to a site using their url.
or just click the big button to allow/block it to all sites.
I arrived here simply wanting to know how to disable javascript in chrome:
Right click on the website
Click "inspect"
Hit keys: ctrl + shift + p
Type: "Java"
Click "disable JavaScript"
Refresh page
It's from here

How can I copy dynamically generated source HTML from the web?

For design purposes, I want to copy the exact HTML that is created by some JavaScript after the page loads. Firebug shows me what's going on, of course, but I really just want some static text that I can copy and paste at will.
The "View Source" menu of the Web Developer Firefox Add-on offers the "View Generated Source" tool.
That can be done with the innerHTML or outerHTML properties. Or just in Firefox, select the part you want the source code from and select View Selection Source from the context menu.
You can copy the HTML out of firebug (or the IE8 developer toolset) into your favourite text editor.
In Google Chrome, choose Inspect Element, then you can right click and "Copy as HTML"
For IE/firefox, following bookmarklet works:
https://www.squarefree.com/bookmarklets/webdevel.html#generated_source
For google chrome, right click on any element and choose 'Inspect Element' option. It will show the position of element in DOM. Now right click on '
For opera, right click on any element and choose 'Inspect element'. This will start opera dragonfly. In dragonfly window, Click on 'Expand the DOM tree' button (first button with a dot and two arrows) and then 'export the current DOM panel' button (second button)
In IE, open the webpage and press F12 to open developer tools. Click View->Source->DOM(page) or shortcut Ctrl+Shift+G in developer tools window. This will show the complete currently visible DOM.
For firefox, alternative is Web developer toolbar extension and choose View Source->View Generated source in it.
you could also write a perl script with the Library mechanize.

Categories

Resources