Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Random link

  1. #1
    Join Date
    Feb 2016
    Posts
    6

    Default Random link

    I have a jpeg on a web page and want the user to be randomly directed to one of two pages when they click on the jpeg. Is this possible in Web Designer 11? Thanks.

  2. #2
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,503

    Default Re: Random link

    Welcome to TalkGraphics

    Not without a script. But Acorn or one of the other clever members may have a suggestion.

  3. #3
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,823

    Default Re: Random link

    Quote Originally Posted by alanbyvale View Post
    I have a jpeg on a web page and want the user to be randomly directed to one of two pages when they click on the jpeg. Is this possible in Web Designer 11? Thanks.
    Depends how you define random.

    Give your image one of the URLs.
    Create a grid of 0 pt (not None so you can see them) lines spaced 8 px apart.
    Place on top of your image and select all and Combine Shapes > Intersect All Shapes.
    Now, randomly pick half of the 8 x 8 px tiles and give them the other URL.

    There are variations on the above.

    A JavaScript approach would be to check the time and return 0 or 1; for 0 pick one URL and for 1, the other.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  4. #4
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: Random link

    I've been looking at JS examples today Acorn, but as you know I'm crap at JS.

    Give your image one of the URLs.
    Create a grid of 0 pt (not None so you can see them) lines spaced 8 px apart.
    Place on top of your image and select all and Combine Shapes > Intersect All Shapes.
    Now, randomly pick half of the 8 x 8 px tiles and give them the other URL.
    This is really thinking outside the box. A really simple, and now obvious, solution but one I'd never of thought of. Sweet
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  5. #5
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: Random link

    As Acorn suggested you can use a random number, just specify something like
    Code:
    javascript:window.location="http://example.com/"+((Math.random()<0.5)?"link1":"link2")+".htm";
    in the "Link to Web or Email address" property.
    Attached Files Attached Files

  6. #6
    Join Date
    Feb 2016
    Posts
    6

    Default Re: Random link

    Thanks to you all for your quick response and variety of ideas. I will endeavour to get it sorted and will report back.

  7. #7
    Join Date
    Feb 2016
    Posts
    6

    Default Re: Random link

    I have tried the javascript solution which seems the simplest. It works in Explorer, popping up a new window with the video showing. However in Chrome and Safari it pops up a new window showing the link as text on a white page. I have tried setting it to 'not specified' and 'open in a new window'. Any other suggestions?

    Thanks,

  8. #8
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: Random link

    Could you try to link to HTML that shows the video instead of linking to the video directly?

  9. #9
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,823

    Default Re: Random link

    Quote Originally Posted by alanbyvale View Post
    I have tried the javascript solution which seems the simplest. It works in Explorer, popping up a new window with the video showing. However in Chrome and Safari it pops up a new window showing the link as text on a white page. I have tried setting it to 'not specified' and 'open in a new window'. Any other suggestions?
    Thanks,
    Ta-da - video? We started with a JPEG. Not a worry for me but if I was an end-user, would I not get frustrated in trying to see a particular video but keep in getting the other? Seems a bit random (bad pun). A bit of a back story might help.

    Well done for getting it started.
    I would aim for a site page that has the video embedded rather than a random (sorry) new tab or window with no return.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  10. #10
    Join Date
    Feb 2016
    Posts
    6

    Default Re: Random link

    There is a particular reason for the random page. Anyway, I created a blank page with a single text box and tried to link to that. It works in Explorer 10, and the latest Firefox and Chrome browsers but not in Safari. I have checked than javascript is enabled but still no joy. If I succeed in sorting it out I will let you know. Again, many thanks.

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •