php中书签,php – 在javascript中制作书签

bookmarklet是一段javascript,它运行在您所在页面的范围内.

它并不意味着只调用任意网址而不能这样做,因为这会违反相同的原始实践.如果您的PHP可以返回JSONP,那么您可以编写一个bookmarklet,它将在页面上插入一个脚本,该脚本会调用您返回的脚本 – 这样也可以显示一个弹出窗口

javascript:

function%20iprl5(){

var%20d=document; // shorten document object

var z=d.createElement('scr'+'ipt'); // create a script tag

var b=d.body; // get document.body

var l=d.location; // get document.location - I would get document.URL instead

try{

if(!b) throw(0); // if there is no body object available

d.title='(Saving...)%20'+d.title; // set document.title

z.setAttribute('src',l.protocol+'//www.yourserver.com/test.php?u='+encodeURIComponent(l.href)+'&time='+(new%20Date().getTime())); // create the script url

b.appendChild(z); // append it to the body - I would append to head myself

}

catch(e){ // give an error

alert('Please%20wait%20until%20the%20page%20has%20loaded.');

}

}

iprl5(); // call it

void(0); // make sure it does not return a value to the window

将此视图源:http://www.instapaper.com/j/deyNbbpjuSei?u = http://www.stackoverflow.com粘贴到位置栏中,查看作为您所在页面的一部分返回的内容

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值