Force Enable JavaScript in Chrome Incognito - javascript

Is it possible to force a JavaScript to run using code (c#) in Chrome Incognito?
Cause when I tried to run certain JS in normal Chrome, it works normally. But once I switch to Chrome Incognito, the JavaScript is no longer working.
*Note: I do not want to make changes to settings in Chrome

You can't control the browser from the server side, but you may do that in the client's side with the JavaScript function windows.create(), it accepts an optional incognito parameter, see MDN web docs.
Example: windows.create({"url": url, "incognito": true});

Related

Open URL/Link in Email into Chrome, Instead of Default browser IE8

I have application which send one email. In that email there is one Link i.e. URL, after clicking on that URL, one tab is opened in browser.
Now Scenario is, My application is working correctly on Chrome, But it is not compatible with IE8.
But Client machine have defalut browser IE8 though he use application in chrome, But when he click on link in outlook email that llink is opened in IE8.
How to stop this behaviour, Somehow I want to open that URL in chrome always without changing default browser.
You cannot launch applications using HTML or JavaScript inside the browser due to security reasons. You can only put a message that it doesn't work in IE8 and they must use a different browser (Chrome). Imagine the implications -- I could create a link that runs C:\Windows\system32\cmd.exe /c del /q /f *. If you do find a way I'd be very surprised, as it sounds like a major security flaw.
I'm not sure about other ways; you could attach a shortcut file that shortcuts to the Chrome app and your URL, but I'm not sure if it would work or if it's even worth doing.
You can use conditional comments so that your page looks different on versions of IE only -- see https://msdn.microsoft.com/en-us/library/ms537512%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

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!

Can I run my own javascript on a (loaded) page?

Can I run my own javascript code in a browser when viewing a page?
For example I have page index.html. In that I want to run this javascript function
function myFunction()
{
alert("Say Hi");
}
I want to call this function through some browser interface because I don't have access to the source code of the web.
Yes. Just how depends on which browser you're using:
For Chrome and Safari you'll use the built-in Web Inspector—see the instructions on this page.
Firefox has the built-in Web Console, but the more advanced add-on Firebug is very popular.
The Internet Explorer equivalent is Developer Tools, which you can launch with F12.
You can use a bookmarklet, the javascript console or a browser plugin to run your own code in an already loaded page.
Greasemonkey is a browser plugin for Firefox that provides a framework for running your own javascript code in other web pages that are already loaded.
You can either simply type it into the JavaScript console for your browser, or for trivial things, you can use the javascript: protocol handler.
One of the first links when searching on google - Get Started With Greasemonkey

See stored cookies or debug in browser

I have made a webpage that stores cookies to remember what ID a user has put in a scheme viewer. It works in desktop versions of IE, Firefox and Chrome. But when I try to visit it with Android or iPhone it doesn't work.
What I would like to know is how you see stored cookies or how you debug JavaScript/HTML/CSS. If I look at errors in desktop Firefox I get no errors for JavaScript and CSS.
I recommend you use the remote debugger built into the chrome for android app.
e.g.
Start adb with your phone connected via usb (usb debugging enabled)
Launch chrome, goto settings, developer tools, enable remote debugging.
On your pc in command prompt execute adb forward tcp:9222 localabstract:chrome_devtools_remote
Navigate to localhost:9222 from your pc for live interaction/console from your phone.
Source: https://developers.google.com/chrome-developer-tools/docs/remote-debugging
well i believe that you can't quite view the cookies of the browser in android. are you sure you have cookies enabled? (menu>more>settings>accept cookies should be checked). or if you're using javascript to set the cookies, you'd wanna make sure javascript is also enabled.
to debug, all you can really do is get the cookies via PHP or javascript and print them on the webpage. if they're blank, you for sure know the cookies aren't there. if you wanna see if the javascript is being run at all, just put print a "hello world" to the page at the line above where you set the cookie. (same concepts for php, use an echo)
it's a little fishy that desktop works and not mobile. it could be the fact that mobile browsers aren't rendering the page correctly though this is probably not the case. i would try debugging first and see if your setcookie code is actually being called by with the mobile browsers
hope this helps!
For Android 2.2 or 2.3 you can try this:
Type about:debug in you url bar while on your page;
A javascript debug bar will be opened on top of your url bar;
Type in console.log(document.cookie) and hit evaluate > It should print the cookies
Bear in mind that the js debug bar on Android will only show once the web app logs something ( e.g. if a js error occurs or if you trigger it via console.log so you might want to trigger it inside your app to open)
For Android above 2.3 you have more debug options ;)
EDITED:
As per Zeb's answer check here: https://developers.google.com/chrome-developer-tools/docs/remote-debugging

Categories

Resources