Get current URL with jQuery?

后端 未结 30 2229
你的背包
你的背包 2020-11-22 02:44

I am using jQuery. How do I get the path of the current URL and assign it to a variable?

Example URL:

http://localhost/menuname.de?foo=bar&nu         


        
30条回答
  •  抹茶落季
    2020-11-22 03:07

    To get the URL of the parent window from within an iframe:

    $(window.parent.location).attr('href');
    

    NB: only works on same domain

提交回复
热议问题