Link through javascript
-
Experts, I have a problem which i need help with, I have a javascript page which will detect the users browser, if it is below a certain defined state another webpage will be displayed saying. Unfortunatly your web browser is not up to date. This has all been done however how do i link pages through javascript? i thought this would work however it doesn't
document.write("<href='oops.html'>");
I have also tried closing the javascript and opening a html tag (would look something like this)
</script>
<a href="../MWHAHA website/oops.html"></a>
<script type="text/javascript">all i would like to do is open a html page if a statement is true or not. If anybody can help that would be great Cheers Dan
-
Experts, I have a problem which i need help with, I have a javascript page which will detect the users browser, if it is below a certain defined state another webpage will be displayed saying. Unfortunatly your web browser is not up to date. This has all been done however how do i link pages through javascript? i thought this would work however it doesn't
document.write("<href='oops.html'>");
I have also tried closing the javascript and opening a html tag (would look something like this)
</script>
<a href="../MWHAHA website/oops.html"></a>
<script type="text/javascript">all i would like to do is open a html page if a statement is true or not. If anybody can help that would be great Cheers Dan
location.replace('oops.html'); But, your scheme seems wrong. Exactly which browsers will you disallow, and for what reason?
-
location.replace('oops.html'); But, your scheme seems wrong. Exactly which browsers will you disallow, and for what reason?
Hi thanks for your reply! I will be disallowing browsers such as internet explorer which is < version 6 as my website will not function correctly in it. I tried the location.replace('oops.html') but nothing happened. The code i need something simular to this if interent explorer <6 then open url opps.html else do nothing In the javascript i cannot get the url to load the page. Thanks
-
Hi thanks for your reply! I will be disallowing browsers such as internet explorer which is < version 6 as my website will not function correctly in it. I tried the location.replace('oops.html') but nothing happened. The code i need something simular to this if interent explorer <6 then open url opps.html else do nothing In the javascript i cannot get the url to load the page. Thanks
putting this in head will redirect IE browsers less than 6 (google 'conditional comments') Commonly, the necessary features are checked and the page redirected if they are present leaving browsers which do not have desired features at current page, the current page will explain the problem to the user. Users with appropriate browsers will not see the current page because they will have been redirected. (google 'javascript feature testing') Also, if a necessary feature is missing from browser there is always a javascript work-around that will compensate, unless of course it's javascript thats missing. In that case it will not redirect! So leaving that browser on current page is good option.
-
Experts, I have a problem which i need help with, I have a javascript page which will detect the users browser, if it is below a certain defined state another webpage will be displayed saying. Unfortunatly your web browser is not up to date. This has all been done however how do i link pages through javascript? i thought this would work however it doesn't
document.write("<href='oops.html'>");
I have also tried closing the javascript and opening a html tag (would look something like this)
</script>
<a href="../MWHAHA website/oops.html"></a>
<script type="text/javascript">all i would like to do is open a html page if a statement is true or not. If anybody can help that would be great Cheers Dan
location.href = 'newpage.html';
-
location.href = 'newpage.html';
NeverHeardOfMe wrote:
location.href = 'newpage.html';
The difference between location.href and location.replace is that location.href creates a new history entry on the visitor's browser while location.replace replaces the history entry. If the history entry is not replaced the back button will lead to the redirect page again causing 'redirection loop' which is usually undesirable and may have unwanted side effects.
-
NeverHeardOfMe wrote:
location.href = 'newpage.html';
The difference between location.href and location.replace is that location.href creates a new history entry on the visitor's browser while location.replace replaces the history entry. If the history entry is not replaced the back button will lead to the redirect page again causing 'redirection loop' which is usually undesirable and may have unwanted side effects.
TIL... to RTFM properly! I stand corrected... :thumbsup: