locked
window.open not working RRS feed

  • Question

  • User-775831949 posted

    I am using on JS button click function with this code

    window.open("www.xxxxx")


     to divert

    It does not work even I turn off Ad Block.

    Is this code not working in major browser anymore ?

    What option I have in JS/jquery ?

    If this is not possible due to security, what is the code to change the default hyperlink on the page ?

    I have this on page top

    <a href="something>Old Link</a>

    How to code so url of this <a> changed to newurl for user ? (or change hyperlink of a button)

    var newurl = "another thing";
    var newurlName = "New Link"

    Thanks

    Saturday, September 30, 2017 12:26 AM

Answers

  • User2053451246 posted

    Are you doing this in a function the user calls by choice by a button click or some other interaction? If you expect it to work without a user initiating window.open it will never work. The ability to do that went away when we stopped seeing websites that
    launched multiple ad windows as at us.

    Edit: ignore this if you are actually requiring the user to make this happen by choice. You did say it’s a button click event. You calling the click code in your code shouldnstill stop this from happening.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 30, 2017 12:36 AM

All replies

  • User2053451246 posted

    Are you doing this in a function the user calls by choice by a button click or some other interaction? If you expect it to work without a user initiating window.open it will never work. The ability to do that went away when we stopped seeing websites that
    launched multiple ad windows as at us.

    Edit: ignore this if you are actually requiring the user to make this happen by choice. You did say it’s a button click event. You calling the click code in your code shouldnstill stop this from happening.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 30, 2017 12:36 AM
  • User-775831949 posted

    Your reply is very valid.
    It is user click but it is not buttonclick.

    I am using a js plugin and user click trigger a series of call back...:

     eventHandlers: {"click": function (e, value) etc....
    
    

    so there are a lot of steps first and I am adding new window.open at the end hoping adding a function to open new windows

    So it may not be same as direct buttonclick...

    So I now believe window.open is not possible...

    Then what is the code to change the default hyperlink on the page ?

    I have this on page top

    <a href="something>Old Link</a>

    How to code so url of this <a> changed to newurl for user ?

    var newurl = "another thing";
    var newurlName = "New Link"
    Saturday, September 30, 2017 12:59 AM