Passing a URL as a GET parameter in Javascript

前端 未结 5 677
半阙折子戏
半阙折子戏 2021-01-04 10:07

I am trying to make a bookmarklet that uses the user\'s current URL, kind of like the tinyURL bookmarklet that uses this javascript code

javascript:void(loca         


        
5条回答
  •  说谎
    说谎 (楼主)
    2021-01-04 10:48

    Try

    javascript:void(location.href='http://mywebsite.com/create.php?url='+encodeURIComponent(location.href));
    

提交回复
热议问题