英文:
How do I get the current browser URL with purescript?
问题
如何在Purescript中获取浏览器的URL,就像在JavaScript中使用 window.location.href
一样?
英文:
How do I get the the browser URL in Purescript, just like when doing window.location.href
in javascript?
答案1
得分: 1
import Web.HTML (window)
import Web.HTML.Window (location)
import Web.HTML.Location (pathname)
import Effect.Console (log)
main :: Effect Unit
main = do
l <- window >>= location >>= pathname
log $ l
英文:
import Web.HTML (window)
import Web.HTML.Window (location)
import Web.HTML.Location (pathname)
import Effect.Console (log)
main :: Effect Unit
main = do
l <- window >>= location >>= pathname
log $ l
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论