最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Prevent user changing URL in browser - Stack Overflow

programmeradmin1浏览0评论

I want to make the URL from a next page non-editable when I open a link like this:

<a href="javascript:window.location=''">Enter Lobby</a>

Is it possible to make the window.location parameter non-editable through Javascript or PHP?

I want to make the URL from a next page non-editable when I open a link like this:

<a href="javascript:window.location='http://google.co.in?test=raj'">Enter Lobby</a>

Is it possible to make the window.location parameter non-editable through Javascript or PHP?

Share Improve this question edited Jan 28, 2014 at 10:59 Patrick Hofman 157k23 gold badges267 silver badges339 bronze badges asked Jan 28, 2014 at 10:02 RajanRajan 751 gold badge1 silver badge13 bronze badges 1
  • 1 Do you mean: prevent the user to edit the URL in the browser? – Patrick Hofman Commented Jan 28, 2014 at 10:04
Add a ment  | 

1 Answer 1

Reset to default 7

See this w3schools article on window.open:

window.open("http://yoururl/", "title", "location=no");

The third argument are the specs. Pass location=no there.

If you want to disable URL change on the current page, sorry, that is not possible.

发布评论

评论列表(0)

  1. 暂无评论