Jump to content

Open a new page in inline code?


Recommended Posts

It's not a case of "just thinking".  There is a decision making via the "if" statement so I don't see why there shouldn't be a facility to go to a new page based on the decision.  One should be able to do "anything" without human intervention.  However, it seems that is not possible with website programming - something I consider a deficiency.

Nonetheless, thanks for your help!

Link to post
Share on other sites
  • 2 weeks later...

You don't need JavaScript at all. I was formerly using it for inline code but have beefed up my security settings by disallowing all forms of inline code, now I use a meta tag like this;

<!-- Replace the zero with how many seconds of delay you want before the refresh is triggered -->
<meta http-equiv='refresh' content='0;url=https://example.com' />

If you really want to use JavaScript you could use this;

<script>
// The following replaces the current URL with a new one
window.location.replace('https://example.com');

// Or with a time delay in microseconds (currently set at 2 seconds)
setTimeout( function() {window.open('https://example.com','_self')}, 2000);
</script>

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...