I'm not really bright at JavaScript, so how do I add to "w.location.href"?. I tried searching, but it's hard to formulate the right question too.
This is part of a bookmarklet for Chrome:
encodeURIComponent(w.location.href)
This will return the active URL in the broswer adress field, like http://www.domain.com . But how can I add to it so the ending will be like, " http://www.domain.com/?rcode=abc1234 "?
I tried this:
encodeURIComponent(w.location.href + "?rcode=abc12345")
and
encodeURIComponent(w.location.href + ('?rcode=abc12345')
But nothing workes, OR, it droppes out the "=" in the added string.
--
Ok, I'm adding the EDITED "flipit" code here:
javascript:void((function(d,w,p,s,r,t,l)%7Bt%3D(w.screenTop%7C%7Cw.screenY)%2B50%3Bl%3D(w.screenX%7C%7Cw.screenLeft)%2B(w.innerWidth%7C%7Cd.documentElement.offsetWidth%7C%7C0)/2-s/2%3Bw.__flipboard%3Dw.open(%27https://share.flipboard.com/bookmarklet/popout%3Fv%3D2%26title%3D%27%2BencodeURIComponent(d.title)%2B%27%26url%3D%27%2BencodeURIComponent(w.location.href + "?rcode=wlb535")%2B%27%26t%3D%27%2Bp,%27__flipboard_flipit%27,%27width%3D%27%2Bs%2B%27,height%3D%27%2Br%2B%27,top%3D%27%2Bt%2B%27,left%3D%27%2Bl%2B%27,location%3Dyes,resizable%3Dyes,status%3Dno,scrollbars%3Dno,personalbar%3Dno,toolbar%3Dno,menubar%3Dno%27)%3Bs%3Dd.createElement(%27script%27)%3Bs.setAttribute(%27type%27,%27text/javascript%27)%3Bs.setAttribute(%27src%27,%27https://d2jsycj2ly2vqh.cloudfront.net/bookmarklet/js/popout-helper.min.js%3Ft%3D%27%2Bp)%3Bd.body.appendChild(s)%3BsetTimeout(function()%7Bw.__flipboard.focus()%7D,50)%3B%7D)(document,window,(new Date().getTime()),535,565))
Try this:
var url = window.location;
url = encodeURI(url + '?rcode=abc12345');
如果要以编程方式更改位置,请使用:
window.location.href += encodeURIComponent('?rcode=abc12345');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.