I am working on a project. The project is about developing a new extension for Google Chrome. Well everything works fine, but out of curiosity, I came to a question, if you could restart Chrome browser, after you installed your extension?
I have been looking around the internet and didn't get much success from it. Is there any Javascript code for it?
I tried with those bellow, but with no success.
chrome.tabs.create({ 'url': 'chrome://restart'});
chrome.send('restartBrowser');
window.location = 'chrome://restart';
I thank you in advance!
No, allowing JavaScript to restart the browser would be a risk. Imagine if you open a malicious page that restarts the browser once it opens up, this would put it in an infinite loop where the browser keeps on restarting itself.
Related
I created an userscript to help me farm on a browser game. I have been running it in the background, on my pc, and everything was going on great, but.
I want to be able to run it on my old phone so that I won't have to keep my pc open all the time (I wanna run this 24/7). I have tried using tampermoney for android, but I couldn't get it to work at all, so I started using DevTools and injecting the javascript code into the page manually trough console with a Snippet.
The problem is that the game session expires after a while, and I couldn't find a method to log back in without refreshing the page, but once I do that, the script is lost and I have to reconnect my phone to my pc and inject it using DevTools.
Is there any way I could keep the Snippet after refreshing, inject the userscript without DevTools or is there any other solution you can think of?
Greasemonkey was available for older Firefox versions on Android. I think support stopped around August 2020. Until then it seemed to work fine to me.
I don't know if it is still possible to install Greasemonkey if you install an old Firefox version on Android but it's worth a try.
Another solution would be to create your own Android app. In an Android app you can use WebView to display a website and inject javascript with evaluateJavascript(codestring, callback)
I'm growing frustrated with the whole mix of Spring Tool Suite, Tomcat and Chrome. I'm working on a website's back end and I'm having all sorts of troubles getting my webpage to reload properly when I make changes to the JavaScript. I've made a fix to a problem in my code and when I go to preview, the error is still there. When I inspect the JavaScript in the Chrome Dev Tools, I see that it is still loading the JavaScript before I made the change, despite me having saved the file. I've rebooted Tomcat, I've been using Incognito mode, I've been deleting my cache and yet even in incognito, Chrome won't dump the old JavaScript file for the new one.
It's getting frustrating, because I waste time with every change I make with the JavaScript trying to wrestle with Chrome and Tomcat to get my webpage to use the most recent saved version of my JavaScript. I don't know if this matters, but I'm not writing my JavaScript in STS with Tomcat and my Java code, but it is in the same folder as my project and when I open it in STS, it always has my most recent save changes anyways.
Is there any fix to this?
I've developed some Chrome apps and Chrome extensions these day for fun.
and I'm wondering if I can schedule launch Chrome app and run certain commands periodically like cron jobs.
I know Chrome provide "chrome.alarm api" to run a certain function periodically, but I believe it requires users to keep my chrome app open or to keep chrome browser open which my chrome extension is installed to.
Please tell me if I can do such a thing in the first of all, and if I can do, please tell me how I can accomplish that!
A Chrome App doesn't have to be running to use the chrome.alarms API. See https://developer.chrome.com/apps/alarms for details about how to use it.
Basically, here's how it works:
// background page (aka event page)
chrome.alarms.onAlarm.addListener(function() {
// Do something useful...
});
// Register an alarm that will wake my background page every hour.
chrome.alarms.create('', { periodInMinutes: 60 });
For info, here are some good Chrome App samples that use chrome.alarms at https://github.com/GoogleChrome/chrome-app-samples/search?utf8=%E2%9C%93&q=alarms
A Chrome Extension can stay active even before/after Chrome is launched, unless the user specifically forbids that. Kind of like Google Now operates in recent Chrome versions.
For that, you need to declare "background" permission.
Makes Chrome start up early and and shut down late, so that apps and extensions can have a longer life.
When any installed hosted app, packaged app, or extension has "background" permission, Chrome runs (invisibly) as soon as the user logs into their computer—before the user launches Chrome. The "background" permission also makes Chrome continue running (even after its last window is closed) until the user explicitly quits Chrome.
I'm afraid it's not an option for a Chrome App though. The wording in the documentation refers to deprecated legacy app types. See François's answer for a possible solution in Apps.
I am developing a localhost project that keeps sending requests to your-mime-site.com.
I have included these jquery plugins:
jQuery
jQuery.form
jQuery.validate
jQuery.ui
Everything else I have coded myself.
I have tried to use NetBeans to search the project for the string "your-meme-site" but it says that some lines are too long to be searched.
Does anybody know why or how this is happening?
One thing I can think of is your PC / network has been infected by virus that alter the DNS entry such that request to any arbitrary site gets redirected to your-mime-site.com
On Windows DNS host file exists on C:\windows\system32\etc\hosts. On UNIX it's on /etc/hosts. Ensure you don't have your-mime-site.com entry there.
Try looking in the "Initiator" column in the "Network" tab of Chrome's inspector to find what's triggering it.
I disabled Garmin Communicator Plugin, BitCommet Video Player, Youtube Video Replay, and Java Console, the request went away.
I did reenable the Avast plugin and it is not the culprit, for anybody else who might get this problem.
I found my problem. It was an extension in Firefox. I started firefox in safe mode and the problem was gone. Then disabled plugins and extensions one at a time till I found out it was a download flash video extension I had installed. Uninstalled the extension and it is gone.
I'm having a really annoying problem with debugging javascript with VS2008.
If I simply press F5 (or choose 'start Debugging' from the Debug menu), the iexplore process is attached, but no breakpoints break in the scripts. The Script Documents tree doesn't even appear in the solution explorer.
I already know:
I can set a breakpoint in Javascript just fine. It does NOT show the "This point will not be hit" message.
Calling the debugger through using the 'debugger' keyword works fine, but attaching to the iexplore process doesn't since it gives a "process already attached to a debugger" message.
Using the manual 'Attach to process...' works just fine. The Script Documents appears as well.
The project has recently been converted to a Web Application from a WebSite.
I already tried:
Clearing the IE cache.
Shutting down VS2008, Stopping the IIS and deleting the temporary asp.NET files restarting both IIS and VS2008 afterwards.
Setting IE7 as the default browser both for windows and for VS2008.
Resetting my user settings for VS2008.
Checking that IE script debugging is enabled.
Nothing has worked so far. While Attaching to process isn't too taxing, it is very annoying when I'm used to just hitting F5.
If anyone can think of a solution, please please please (I'm begging here!) let me know!
Is silverlight debugging enabled on the website project properties? This will disable Javascript debugging.