将父页面网址拉到iframe中的chrome扩展程序

时间:2015-12-11 12:25:33

标签: javascript jquery html google-chrome iframe

我有一些JavaScript代码可以返回当前访问过的网页的网址。此代码作为href链接运行。当我使用Chrome扩展程序在iframe中打开页面(可以是不同的域)打开它时,我想这样做。 iframe打开正常,但网址不会填充。我尝试window.parent.location类型无济于事。

javascript:void(window.open('http://www.example.com/..?s=%20'
    +encodeURIComponent(document.title)+'%20'
    +encodeURIComponent(location.href)+'%20'
    +encodeURIComponent(window.getSelection())))

0 个答案:

没有答案
相关问题