How do I access a chrome performance profile from JS code? - javascript

I created a chrome performance profile for my code using console.profile('myProfile'). After that, I performed some interactions and then stopped the profile by calling console.profileEnd(). I can see that the performance profile was successfully created under the JavaScript profiler tab in the DevTools.
My question is: How do I access the created profile from my JS code?

Related

why console log doesn't show in executions when ran by external webapp instead of head? [duplicate]

I deployed my Google App Script Webapp with the optionen execute the app as: User accessing the web app.
In the App Script Dashboard I can see the executions of the webapp and the logging. However I only see the logging when I (the owner of the app) executes it. When another user executes the webapp I only see the executions but I can not see the logging int the App Script Dashboard.
How can I also see the logging of the app independent of the user executing it?
You have two ways of seeing the executions:
Allow the other users to edit the script (if it is on developing mode), then you will be able to see all the executions from the Apps Script Dashboard.
You can link the script to a GCP project, and then you will be able to see the executions from the GCP Logs viewer. You can enter the GCP logs viewer from the script: View -> Stackdriver Logging
The issue is reported here. Consider adding a star (on the top left) for Google developers to prioritize the issue.
In the mean time, As mentioned in the previous answer, Switching GCP should work:
Switching Google cloud project
View Logs at View > Stackdriver Logging

Using html and JS to view all currently open tabs

Im new to JS and was wondering if it is possible to write a script which would collect the data of all open tabs and display it.
There is currently no way of controlling the data of browser tabs or other browser tabs with Javascript but there are some other things you can do with tabs like going to the nth tab of a window.open() array.
Check out this StackOverflow answer
I don't think there is a way of accessing data from a tab in a browser because of a sandbox that separates the Javascript running in a thread on the webpage and the user's computer. If you were hoping to use this in a Google Chrome extension, this is possible. It's called chrome.windows.getAll(), you can learn more about it at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/getAll.

Gridsome project hosted on netlify. On click, pages dont load even though the URL does update

My site deployed is deployed on Netlify and when clicking on any link on the landing page, the url updates but the content does not show unless i refresh the page. note on my local development server this is not an issue. Its only an issue on the live site
Note: there is not much literature on this. On the https://github.com/gridsome/gridsome/issues , Issue #324 and issue #337 both raised the same issue though the answers are not applicable in my project.
1)check out the live site at ezrasnashim.netlify.com.
Try click on any links on the landing page
Environment
#gridsome/cli v0.3.1
gridsome v0.7.12
browser:
firefox developer browser,
google chrome browser
After going through the site, I found the issue was some invalid HTML, which the browser fixes [changes around], which changed the actual DOM from the virtual DOM, which caused the Vue hydration to break.
See Vue SSR hydration caveats

Get live html feed from website

When a webpage like https://poloniex.com/exchange#btc_eth is opened in the browser, we see that the browser constantly shows updated buy and sell orders. Also, in the Elements section in the chrome console, these updates are visible in the HTML tables.
Is there a way I can use a nodejs script run on my pc (so not in the browser console) to get these live html table updates from that website, without having to do a GET request every time?
If the chrome browser is able to do it, nodejs / jQuery / ajax should be able to do it as well. I tried the XMLHttpRequest nmp module but no luck yet.
It's possible they are using token authentication which means you wouldn't be able to get all the connection info you need just from their client-side code. Have you downloaded it and looked at it yet?
If you find it's not possible to call their services, there are other free products designed for webscraping. AutoHotKey is one that can open a web page and traverse its DOM. I believe it has the ability to run in the background, but don't quote me.

Have JS-code created in the console persist between page reloads?

I have some code which I defined in the Chrome developer tools console:
alert("I was just reloaded");
How can I have this code run everytime I reload the browser?
The code is only defined in the console, in Google Chrome in this particular case.
Note, I don't want just the log to persist, I want the code to persist and to rerun everytime I reload the page.
Ok this doesn't answer the question exactly but achievies similiar results.
Solution: Code can't persist between page reloads in the console. Only the console log can persist. However, if you want code to run each time you reload the page, we can use User scripts: Which basically is your own Javascript code, stored in a browser extension.
So what you have to do is to download the appropriate User Script extension for your browser. Most common are GreaseMonkey for Firefox. A tutorial can be found here: http://hayageek.com/greasemonkey-tutorial/
With this extension you can then create your own JS code to run on specific (or all) web sites, which will then persist between page reloads, which achieved exactly what I asked for.

Categories