我正在为我的网站制作一个书签,现在我有:
<a href="javascript:location.href='http://website.com/compartir_link.php?url='+encodeURIComponent(location.href)" >Save this</a>
wich 工作正常,问题是当我尝试在新选项卡中打开它时:就像我尝试保存时一样:about:blank(在 firefox 中)
而且我希望能够在不丢失当前视频的情况下执行此操作,这就是为什么我考虑弹出,但功能上的 target="_blank"对我有用,
有什么建议吗? 非常感谢!
PD:此链接将作为书签保存在我的浏览器中(可能在我的其他网站中),就像 facebook 的 bookmarklet/sharer
编辑
在你回复后我有这个/js/file.js
jQuery("body").ready(function(){
jQuery(".keep_btn").click(function(event) {
event.preventDefault();
if(this.href=""){
this.href=document.URL;
}
window.open("http://website.com/API/public/compartir_link.php?url="+this.href,'about to keep', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=450,height=400');
});
});
现在我可以在包含以下内容的 iframe 中使用它:
<a class="keep_btn" href="#" style="background-color:red;color:white;">keeps</a>
它可以满足我的需要(以防在外部网站中使用)
但是我怎样才能在常规情况下使用它,以便将它保存到我的浏览器中呢?
我最诚挚的问候
最佳答案
Javascript 调用...
来自链接:
<a href="#" onClick="openIt();return true">Click Here to Open</a>
从表单中的按钮:
<input type="button" value="Open the Window" onclick="openIt()" />
function openIt() {
w=window.open(linkUrl, reportName, "resizable=yes, directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,top=50,height=600, width=900");
}
关于javascript - 我需要什么才能在弹出窗口或新窗口中打开它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4941033/