I want to measure the HTML parsing time of some webpages. One difficulty is the parsing and JavaScript execution happen alternatively.
I am not familiar with html and javascript, is there any simple way to disable the execution of the scripts?
E.g. inserting <noscript> to some places (I am not sure if this will work)
By the way, I do experiments on Android.
You can disable JavaScript in Chrome developer tools. Click on settings icon on lower right of the tool then you will find the settings.
Type
chrome://settings/content
in Chrome browser address bar.
Under JavaScript section select "Do not allow any site to run JavaScript".
Click Done.
Refresh page, JavaScript will not be executed.
Related
I use a lot of JavaScript on my site (currently under construction). My worry is if some of the client side's system has JavaScript disabled then my site will "miserably fail".
I know that we cannot programatically override to enable JavaScript as it would be a security issue. But what I want is if the client side system has JavaScript disabled then a popup should appear with a button so that when the user clicks the button automatically JS will be enabled no matter in what browser he is viewing the site.
I am asking this because I saw the same thing myself when I viewed some other site.
That is not possible. You can however display instructions on the page on how to enable JavaScript, but considering that people who disable JavaScript usually know what they are doing they'll know how to enable it themselves.
I'd say there are very few people who accidentally disable JavaScript, so your worries are probably unnecessary.
Well if you want a popup to appear then you need to make it happen using javascript, so I guess the answer is that you can just ignore the very small percentage of people who have javascript disabled for their browsers.
What you are probably looking for is Progressive enhancement.
Instead of showing a message through JavaScript that tells the user to enable JavaScript you do it the other way around.
By default you show a message, in a div for example, and when JavaScript is enabled you hide the div. You only use JavaScript to enhance the user experience but offer a 'reasonable' experience when the user doesn't have JavaScript enabled. Reasonable could mean in your case an empty page with some text that explains why you really need JavaScript.
I would like to make a bookmarklet to open google chrome's settings panel and clear my cache with a single click.
For a while now, Ive had a bookmark that opens chrome's settings panel with the 'clear cache' setting already selected. After clicking the bookmark (normally opening it in a new tab) I have to then opent the tab and submit the form. However, when developing this is a task I have to do quite often and these several repeated steps just seem unnecessary.
This link opens the page to clear one's cache (obviously for Chrome users only): chrome://chrome/settings/clearBrowserData#cache
I recently discovered bookmarklets and thought it would be a good way to accomplish the task of clearing my cache with a single click. However, I've discovered that putting even a basic javascript sample in the address bar when on the settings page (linked above) fails to work.
For example, this works in the address bar on any given page, but not from the chrome settings page:
javascript:alert('hello stackoverflow');
Is there a way to execute javascript from the chrome settings page? Are there other options? Im looking for any route to achieve this goal and would love to learn something along the way, even if it means doing some evil. :)
add a bookmark:
javascript:document.write('<form onsubmit="window.open(\'javascript:\'+js_line.value, \'target\');return false;">javascript:<input type=text name=js_line style="width:90%;"/></form><iframe src="" name="target" style="width:100%;height:90%;"/>');
What you want might not be fully possible through a bookmarklet, but it's certainly possible with a Chrome App. There is an app Clear Cache already. I find it pretty useful.
I have one boomarklet, means javascript code that takes current page's source, search for one string (or i can say hyperlink) and changes the current page to gathered link.
The problem is that
i want to make it run infinite times, if possible pausing in between to let the page load.
This is for just one of RPG i am playing, i am bored of Clicking that Exchange Flower link
again and again and again.
and its not offensive, or i ca say not ethical, they have many bookmarklets for doing some other kinda work, so ..
here is the Code
javascript:window.location.href=document.documentElement.innerHTML.substring(document.documentElement.innerHTML.indexOf("museum.php?rfc="),document.documentElement.innerHTML.indexOf("museum.php?rfc=")+18)+"&step=a2";
Thanks anyway...
It seems like you are asking about running some javascript on page load, since the script is navigating the page. Tools like Greasemonkey (for Firefox) are built for just this.
For Google Chrome, you could try this tool which converts bookmarklets into extensions.
I'm using a contrib drupal module that hooks into a form. Its presence appears to cause the jquery to render unreasonably slowly, but I'm not entirely sure about that.. I want to do some advanced troubleshooting on it, and I'm looking for a tool like xdebug that will give me an output file that I can view with KCacheGrind.
I've looked at Venkman and Firebug, but I don't want a debugging environment; I'm not at that point yet. I want to see a profile of the page load so I can see where the majority of the time was spent so I can identify where the problem is.
Edit: I'm actually not looking for a profile of the page load, as several folks have pointed out, but actually a profile of the javascript executed on a particular event. Firebug's debugger can grab the execution and step me into the code, but it just puts me at one point in the big ol' script. I think the slowdown involves loops and iterations, so I want to see a profile of the execution path.
Actually I think I should post this as a separate question.
In Firebug, click the "Net" tab. It lists every element it requests from the server, and detailed connection and load information (on hover) with a nice graphic display without hover.
Update
In addition, if actual page load isn't the issue, and you are indeed trying to profile Javascript, the Firebug "Console" tab probably has what you need.
Click "Profile" and then reload the page. Click "Profile" again to see a list of everything the javascript did with duration and timing information. This should show you what is taking the longest.
The chrome developer tools has a javascript profiler, that will profile all of the function calls on your page. The timeline feature (might only be in beta/dev versions) will show how much time the browser spends on various operations (layout and rendering for example) operations.
I believe that firebug also has a JS profiler.
There is a profiler in firebug in the console tab. Click once to start and second to stop the profiler. Chrome has also a profiler press ⌘⌥j. There is also a good profiling tool for internet explorer: dynaTrace ajax editon.
Btw. most of the time jquery is slow depends on wrong use of the selector engine.
I really want to make google mail by default bottom posting, in other words, I want the cursor in the textarea in a reply message to move automatically to the bottom.
Is this possible with google chrome extensions?
Have you maybe any other suggestions?
Problems I'm facing:
Run the extension script when gmail is fully loaded
The target textarea is in it's own iframe, is it possible to access it?
Yes, you may use the Content Scripts feature of a Chrome extension in order to manipulate the
page a user is browsing. Your content script code will run in the context of the web page the user is browsing, and it may interact with the host page almost without limit.
Manipulating Gmail might be a bit trickier than most other pages, due to its dynamic nature. Consider using the jQuery .live() method to make it easy bind to the elements you want to manipulate.
With regard to iframes, you just have to turn on the "all_frames" option in your manifest, which "controls whether the content script runs in all frames of the matching page, or only the top frame."
(I know this question is a bit stale, but I thought maybe you'd still appreciate an answer.)
I hope that helps.