Navigate command - javascript

I have a page which unfortunately uses the old JavaScript command "navigate" (used to redirect to another page) instead of the currently used "location". There is unfortunately no way for me to change the code so I'm left with having to use IE, which is a problem for example on my PC at home, where I have Linux.
Browsers like Chrome or FF refuse to execute this and show "navigate not defined" in the console. Just out of curiosity, can anyone think of any way how to overcome this? Maybe some extension or possibility to teach the browser custom commands? I tried searching for this but didnt find anything. But before I completely resign I thought I would ask here.
Thanks in advance

Related

Javascript - Find source of console.errors in webpage

I'm developing a React app and incorporated a few packages, some of which seem to be spitting out uncaught console.error messages despite UI and functionality working just fine. The Console output currently looks like this:
I can't seem to find anything online about this, but is there any way I can track down and silence these messages? In particular I'm looking at the one saying Failed to load resource: net::ERR_FAILED, since the others seem to be coming from the React debugger.
EDIT: The error seems to be a side effect of some sort of Adblocker/tracker blocker built into Brave. Is there anyway I can still catch that in my Javascript code?
At first glance it could be something like a cache or some extension. Since you've said that you searched for a solution online and didn't find anything, I believe you already tried these solutions, but if not, here is something you can try:
Start Chrome with your extensions disabled or start in incoginito mode (the extensions will be disabled by default).
Clean your browser cache and cookies.
If you are like me (I hope not) and open 99+ tabs in your broswer, close them, it could be a problem due lack of memory.
Check the network tab to see if Chrome failed to download any resource file.
These are the tips I can give to you, I hope it helps.

Using chrome.tabs.captureVisibleTab() from DevTools console

I'm curious as to whether it is possible to take a screenshot directly from Chrome's DevTools using chrome.tabs.captureVisibleTab (be it from the console or from within a snippet), without going through the process of creating an extension.
Is this somehow possible? If not, how would you suggest going about taking a screenshot that reliably mimics the current page (html2canvas doesn't seem to render everything properly). Thanks for your help.
Here is a page screenshot tool provided by Google. After installed, you may open "chrome-extension://cpngackimfmofbokmjmljamhdncknpmg/js/page_context.js" in browser to see its code. This extension do not use Chrome Extension API. It works well in most pages, except some complicated pages.

IE9 dynamic-page JS issue

I've created a page which utilizes dynamic page loading with JS, it works fine in Safari, FF and Chrome - But of course the infamous Internet Explorer isn't doing a good job.
(I know there are other issues on this page, under the "Cykler" section, these aren't important for this question and shouldn't be focused at)
http://soegaardcykler.dk/beta
Try clicking on one of the categories, Cykler, Info and so on.
The strange thing is that if I open developer tools in IE and set the mode to IE8 and back to IE9 there is no issue, it switches pages like any of the other browsers.
If I close and open IE again the issue is back - If I go to the console to check what's going on it asks me to refresh the page - When I do this the issue is gone again.
I have no idea what the heck is going on, two of my friends have tested as well and they both have the issue when coming to the page for the first time.
I notice you're logging to a console. That's problematic in IE. The console object only shows up if the console is actually open (I think).
There are several solutions out there to avoid console issues; I can't recommend a best practice though besides creating your own logger object (which isn't a bad idea anyway).
Just a side node: I don't know if you're using a Windows operating system, but if you're familiar with the Fiddler2 HTTP traffic analyzer, you can search through sessions really easily. That's how I found the file you missed.
One last edit: here's a good related post: What's the correct way to write to the script console (console.log) in IE?

Tool to get "Timeline" of browser events (including browser events like script evaluation, not just network events) in Firefox?

Simple question, but I haven't been able to find an answer anywhere on SO or otherwise. In webkit's (Chrome/Safari) Developer Tools I can use the "Timeline" functionality to get an exactly look at precisely what is going on inside the browser while it loads a page (when it's evaluating script, when it's painting the screen, when it's downloading resources, etc.). I can also get the same information through Chrome's "Page Speed" extension.
Is there anything like this for Firefox?
I'm experiencing an issue where basically a script is not executing properly but there are no error messages in the console to give me any hit as to what is wrong. I want to try to get a more "in-depth" look at exactly what is happening and when so that I might find a clue as to what is going awry.
Thanks in advance!
Firebug has a timeline feature.

Finding the currently logged in user from a Firefox extension

I'm writing a Firefox extension that needs to know what the username of the currently logged in user is in Windows, Mac, or Linux. So if I'm logged into my machine as "brh", it'll return "brh". Any idea how to do that from extension JavaScript?
Firefox extensions play by different rules to normal JavaScript running in the page: finding the current user is absolutely possible.
Open your Error Console (in Tools) and enter this:
Components.classes["#mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get('USER')
The environment variables Firefox was started with are available through that NsIEnvironment XPCOM component.
You may have to customise this per platform. If all else fails, you might be able to create an NsIFile in ~ then look at its .path; I'm not sure if shell expressions are honoured there, though...
The flagged correct answer works fine. I use this in our extension on Firefox 38. I also use events so that the page can communicate with the extension and retrieve windows properties from the extension.
getWindowsProperty: function(prop){
return Components.classes["#mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get(prop);
},
Don't think that's possible, seems like it would be a security hole if it were.
Yea, not possible... Javascript runs in a secure enviroment, and all FF extensions are javascript so you wont be able to be doing much interaction with the OS... but ill stick around to see if someone knows a way(it would be VERY cool...)

Categories

Resources