搜索当前网站标题和主机书签
我有一个书签,它获取当前网站标题并在我的网站上搜索它:
javascript:q=(document.location.host);void(open('http://example.com/search.php?search='+document.title,'_self','resizable,location,menubar,toolbar,scrollbars,status'));
但现在我想更改此书签,以便它会像现在一样搜索当前网站标题,如果找不到标题,它应该搜索网站主机。所以我想我应该使用 else 选项或其他选项???有什么办法可以做到这一点吗?我想知道书签应该是什么...
谢谢您的帮助!
I have a bookmarklet which gets current website TITLE and search for it on my website:
javascript:q=(document.location.host);void(open('http://example.com/search.php?search='+document.title,'_self','resizable,location,menubar,toolbar,scrollbars,status'));
But now I would like to change this bookmarklet so it will search for current website title like now and if title is not found it should search for website host. So I guess I should use else option or something???? Is there any way to do this? I wonder what the bookmarklet should be...
Thank you for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将代码中的
document.title
替换为:Replace
document.title
in your code with: