Chrome browser console javascript contexts. Firefox cd() function in chrome - javascript

I need to fill some data on my page. But there is a iframe, so i need to get contents from it firstly.
I was told here - How do I cd into an iframe in chrome developer tools or firebug lite in chrome?
that i can cd between the iframes.
So, i tried to do it in the firefox, like this - cd(document.getElementsByTagName('iframe')[0]);
And it works! But how can i do the same thing in the chrome browser? Or maybe you can advice me other things, how to fill fields in the frame. I've got the problem with cross-origin domain.
Is there a way to change programmatically the javascript context like the cd() function do?

Related

Javascript console in mobile WebView

I have a webpage that I want to show in a WebView embedded in a mobile application (for Android as well as iPhone). That webpage is for testing javascript scripts. The page calls a certain set of JS scripts (tests) and these tests give their output into the console (this is where I can diagnose what happened during the tests). Using console.log. Plus exceptions are shown in the console.
When the tests fail, the JS error handler will notify me about and I can show that fact on my webpage so that I can see it on the phone. But I also need to look at the JS console to understand what went wrong.
How do I access the JS console on the phone when the test result tells me it failed?
One option that I was thinking about was to output the content of the console somehow into the webpage content (DOM) so that I can look at it in the app (in the embedded webview since it would be the content of the page shown). But I don't know whether it is possible in Javascript to output the console into HTML somehow.
I do not develop the mobile application, just deliver the content that the application shows in the WebView. Therefore I would need a solution that does not depend on the application itself, just have something I can see in the WebView ideally. Something like when you debug your javascripts in Chrome, you open the DevTools window and work with it. If there was no DevTools on Chrome, would there be a way to see the contents of the console?
Sure I can use various simulators or do the test on other browsers without real phones but this is specifically for tests that fail only on the mobile and I need to find out why.
For Android:
Maybe this link should help you : https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews
Using the Chrome dev mode on your computer, you should be able to debug your webview
About IPhone, I don't know but Xcode or something like should help

Detect from inside of the JavaScript that the Chrome browsers Debugger has attached to my code

I have a web application that consists mostly of JavaScript and I know the only browser thats ever going to open that web page is going to be Chrome.
Is there a way for my JavaScript to realize that the developer console of Chrome has been opened i.e. the Chrome JavaScript debugger has attached?

Debug javascript in opera mini

How do i debug javascript in opera mini?
I have already installed opera mini emulator.
can someone help me how do i debug javascript remotely with dragonfly (firebug equivalent of opera)?
My script does in work in all other browser but not in opera mini
Opera Mini supports console API like this:
server:console?post=http://url/to/your/script
OR
You can dump your log data to source and get source using this command(this fill display source code of current/last page for your device):
server:source
OR
Use remote console services like jsconsole.com. You add script tag with jsconsole script and key. After this use this key on jsconsole site to get the log.
NB: jsconsole script rewrites console.log calling via ajax request
There is, at least for now, no support for debugging a javascript directly in Opera Mini.
You can use document.write to output progress/debug messanges, that is about the extent of debugging posibilities.
Could you point to the script, or at least describe what it is trying to do?
Opera Mini is fairly different from a normal browser, scripts are run on the transcoding servers, and the result of the run is then passed to the client, which can not in fact run scripts.
The client can then pass on clicks and some other events to the script when the user interact with the page, which might change the state/look of the page on the server, which is then sent to the client.

Chrome blocking javascript on localhost

I'm working on developing a site on my local machine (Windows 7 Ultimate x64) using WAMP, running APACHE v2.2.22, PHP 5.3.13, and MySQL v5.5.24. I'm developing using Chrome v 22.0.1229.94. I've got quite a bit of javascript in the site, however, and Chrome is relentlessly blocking javascript from running on the page.
Clicking on the little 'blocked javascript on this page' icon in the address bar includes the dropdown that has "Always allow Javascript on Localhost" checked off, and I also have a JavaScript exception in Chrome's settings explicitly saying to always allow JavaScript on 'http://localhost'.
Cookies are being allowed, "Allow all sites to run JavaScript" is checked off, and I have no idea as to why Chrome is not allowing the JavaScript to run.
Overall, it's not imperative to the project that I figure out a fix as both IE9 and Firefox 16.1 are allowing JavaScript and I can utilize them. I am simply curious if there's anything I can do to fix this in Chrome, as I would like to continue developing in Chrome.
If you notice that JavaScript is only blocked when the console is open (as some are saying), chances are that you disabled JavaScript in the console settings.
Open the console.
Click the vertical ellipsis icon (or the gear icon on older versions) in the upper right and go to settings.
See if the "Disable JavaScript" checkbox is checked.
I have the same issue, but only when the console is open. When the console is closed, JavaScript loads fine on localhost. Makes it hard to debug things though....
I got around it by opening localhost in an incognito window.
You can give your local server a domain name, may be that would help.
Open C:\Windows\System32\drivers\etc\hosts in notepad
Edit that file add a new line at the end
127.0.0.1 mydomain.com
Save, now goto chrome and type in http://mydomain.com/ this should point to your local server.
Since you nolonger run on "localhost" may be chrome will let you pass.
Let's me know if that works. Good luck!

about call Chrome API or Chrome Extensions with Javascript in Chrome

I write a HTML page and I want call a Chrome API(eg tts) with a Javascript function which in my HTML page.
BTW: I don't want to create a Chrome Extensions, just want run as a web app.
Is that possible ? If can be possible, how do I do ?
With very few exceptions, chrome.* APIs can only be used within the context of a chrome extension. There are a few exceptions, but probably none that you want. To see them, press F12, type chrome into the prompt, and click to expand the returned opject.

Categories

Resources