Jumping to a new HTML page with JavaScript

后端 未结 2 1086
[愿得一人]
[愿得一人] 2021-01-12 14:42

In my HTML page, I need to check if Adobe Flash player is installed. If not, I want to automatically jump to another HTML page to tell the user that Flash player is required

2条回答
  •  醉话见心
    2021-01-12 15:31

    window.location.href = "http://stackoverflow.com";
    

    For local files this should work if you know the relative path: (In your case this works.)

    window.location.href = "someOtherFile.html";
    

    Maybe you could also do it absolute using this: (Not tested.)

    window.location.pathname = "/path/to/another/file.html/";
    

    The problem are the security measures of the browser vendors. Google has some good information about it.

提交回复
热议问题