how to disable javascript in chrome by code - javascript

we kown that chrome provide us the method to disable js in web developer Panel.
but i want to disable js from chrome extension by the interface if chrome provide
if chrome dont allow developer do this ,
if i can get the list of the element banned loading when set disabled in panel.
thank you

If you're trying to stop a particular script from loading (is that right?), consider using Chrome's webRequest API to stop it from even being loaded in the first place. The API reference contains an example of how to cancel a request. (Note that the first example is for demonstration purposes; the second example is more efficient if you know the URL in advance.)

Related

How can I initiate Ajax request from firefox developer tools?

I want to test several Ajax requests after the backend code completed. Now my method is adding a dummy button, an onclick event and an ajax request inside that.
Is there any way I can initiate Ajax request for testing from firefox-developer-tools without editing my jsp / frontend?
You can use Scratchpad, Firefox's dedicated tool for executing JavaScript.
From docs:
Unlike the Web Console, which is designed for interpreting a single line of code at a time, Scratchpad lets you edit larger chunks of JavaScript code, then execute it in various ways depending on how you want to use the output.
Just open up Firefox and hit Shift+F4 and you are good to go. using Ctrl+R you can run your code (whole code or selected parts)
BTW you can have Scratchpad as a tab in dev tools, of course it's not enabled by default, but you can enable that via dev tool options.

USING iMACROS to monitor/record HTTP requests (image request) after running Javascript?

I am working on a project to find a tool or solution solution with iMacros that will allow me to automate a large portion of regression testing on our site. The main scenario that I'm trying to make work goes like this:
Use tool iMacros to go through a set of actions - in this case,
a) Visit site
b) Login to site
c) Use search bar on screen to search for product
After the search page loads, there is a header that I need to verify. For this particular scenario, the expected result is "v1=header".
If I were not trying to make a macro from this, I could easily manually find it and observe (i.e. pressing F12 in Chrome, clicking "Network", sorting by the term "b/ss" and finding the "v1=" from the list after the search page loads.
What I cannot seem to do is to record this action, then reply it later and record the results. I am currently evaluating iMacros, by itself and with the Firefox add-on and Chrome extension. iMacros seems to be the answer to this...but all of my searches on how I would make iMacros do exactly this has not been forthcoming.
So far I have tried:
(Chrome) Pressing F12 in window and in its own window - iMacros would not respond to anything done within that window
(Firefox) Recording clicks and button presses while using HTTPFox when viewing the results - again, iMacros would not respond to anything in that window
Having iMacros take a screenshot while HTTPFox was open with the information I was looking for - the screenshot only showed the page without the HTTPFox information.
Considering I have very little experience with html and javascript, I'm running out of options to search for. Anything that anyone can come up with would be greatly appreciated. Thank you in advance for your time.
Determined that iMacros does not have the capability to do what is needed, and will not recognize any web dev panel (firebug, httpfox, etc) when recording macros or screenshots.
Utilized approxiblue's suggesting to check out Selenium (Webdriver), which after a week of code-surgeoning with examples from various sites, was able to piece together a combo of Webdriver/Firefox/Firebug/NetExport to listen to the http requests when performing a search and then exporting the events to a .HAR file.

Website inside firefox addon

Can we embed a website inside a firefox addon. I am currently building an addon with multiple functions and though addon is appropriate for few functions, website is better for rest of the functions.
If I intend to create an addon and also have website embeded inside it for some of the operations, is it possible. How do we do it?
Yes, you can have web-content in a Firefox addon, but be very careful or else the web page (or anything that intercepts the web page) will have access to everything Firefox itself could do!
If you use an XUL iframe (or any iframe element or runnable data inserted from untrusted content in Chrome:// context), please read this article carefully:
https://developer.mozilla.org/en-US/docs/Displaying_web_content_in_an_extension_without_security_issues
I'd advise to use iframes for this one.
Check:
http://www.w3schools.com/tags/tag_iframe.asp
and
http://webdesign.about.com/od/iframes/a/aaiframe.htm
see my addon here: https://addons.mozilla.org/en-US/firefox/addon/xpicompiler/
see about:addons-memory addon here: https://addons.mozilla.org/en-US/firefox/addon/about-addons-memory/
very simple addons, they contain a webpage. and in the manifest file we have set contentaccesible=true
in my addon if you type about:xpiler you get to that pgae
in the other addon if you type in the url bar about:addons-memory you get to his page.
if you need help i can write a demo for you in 10 minutes

Is it possible to update a javascript method via debugger in firefox and chrome?

Does anyone knows the steps to change javascript function via debugger in firefox or chrome? Is there any serious security concerns in it?
The steps to change JS function using chrome devtools are as follow:
Open chrome dev tools (you can use right-click and then choose inspect element).
Open the 'Source' tab.
Choose the javascript file that contain the function you wish to change.
Edit the code.
Click on 'ctrl-s' to save it.
You are done. If this code is being called from an event on the page (e.g. click on a button) you will be able to see your changes without any reload.
As for security concerns, you should always validate the user input on the server side. On the client you should 'guide' the user to enter the right data but never trust it. There are many cases where someone will be able to change the data 'on the fly' (=man in the middle) so you should never trust the client.

Detecting the language of a frame or a string using Chrome extension?

I am writing a Google Chrome Extension. Now I need to detect the language of a frame in a tab. I read the post Detecting the current tab language using Chrome extension? but the answers involve examining the whole tab, apparently. Here I am in a chat and I have to examine a response in a table in a frame to see if the respondent has changed languages so that I can respond appropriately.
So what I have is either a frame or a string from the table.
Any suggestions? I am writing in javascript and I am not familiar with jquery.
Not directly in the Chrome Extensions API's, but you can create a content_script that attaches a element.addEventListener("DOMNodeInserted", function() { something }) listener to the area you want to examine and then fire off a request to the translate api to detect the language.

Categories