本文介绍了如果在某个网页上运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个加载音乐播放器的脚本,但我只想在播客页面上运行它。
I have a script that loads a music player but I only want to run it on my podcasts page.
如果window.location是example/podcasts那么它应该类似于,然后< script> blah< / script>
It should go something like if window.location is example/podcasts then <script> blah </script>
我该怎么做? 谢谢!
How can I do this? Thanks!
推荐答案javascript将是:
The javascript would be:
<script type="text/javascript"> if(window.location.pathname == '/podcast') { // script body here } </script>更多推荐
如果在某个网页上运行脚本
发布评论