New Chrome Incognito Window via HTML/JS [duplicate]

天涯浪子 提交于 2019-11-30 16:42:45

问题


Possible Duplicate:
How to open new incognito window with Javascript? (Google Chrome)

Is it possible to open a new incognito window to a URL of my choosing via either some attributes on a hyperlink or some javascript? If it is, how do I do it?


回答1:


There's an easy way if (and only if) you're developing an extension:

chrome.windows.create({
  url: "http://www.google.com",
  incognito: true
});

It requires tabs permission in the manifest, but that's it.

Note that the above has the user consent to allowing the extension to enter incognito mode, among other tab-related permission. I can't tell 100% whether you're developing an extension -- I assume not -- but in any case that's the extension solution and there isn't one otherwise.




回答2:


Seems not. You can not force incognito from within the html/js code. You can only load the browser with

-incognito

switch to force it to incognito on load.



来源:https://stackoverflow.com/questions/6363290/new-chrome-incognito-window-via-html-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!