📜  创建链接并单击 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:55.688000             🧑  作者: Mango

代码示例1
const link = document.createElement('a');
link.id = 'someLink'; //give it an ID!
link.href = 'https://example.com'; // Your URL

//Add the link somewhere, an appendChild statement will do.
//Then run this
document.getElementById('someLink').click();