Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

debugger.SendCommand 'Runtime.evaluate' expression:'window.open' does not work

177 views
Skip to first unread message

dong wang

unread,
Jun 11, 2024, 5:48:12 AM6/11/24
to Chromium Extensions
Codes as below:
await chrome.debugger.sendCommand({ tabId: 71418804 }, 'Runtime.evaluate', 
{                            
expression:"window.open('https://www.baidu.com/')",
includeCommandLineAPI:true, 
executionWorld: "MAIN"
 });

After I copied these code to ServiceWoker console, there's no any effect in the chrome.
However the code "window.close" could work well.Give me help. please!
await chrome.debugger.sendCommand({ tabId: 71418804 }, 'Runtime.evaluate', 
{                           
 expression:"window.close",
includeCommandLineAPI:true, 
executionWorld: "MAIN"
 });

Oliver Dunk

unread,
Jun 11, 2024, 12:09:26 PM6/11/24
to dong wang, Chromium Extensions
Hi Dong,

I just tested with your code in a project based on this sample and it worked well, other than needing to allow pop up windows from the prompt in the address bar.

Screenshot 2024-06-11 at 17.07.43.png

Do you see any errors?
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/66fdda6a-70c9-4508-8d6f-6b252e110bean%40chromium.org.

dong wang

unread,
Jun 13, 2024, 5:46:28 AM6/13/24
to Chromium Extensions, Oliver Dunk, Chromium Extensions, dong wang
Thank you very much. 
Eventually, I solved this issue with adding a property 'userGesture':true 
Reply all
Reply to author
Forward
0 new messages