Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #61198
    Cesar R
    Participant

    Hi, on the Tactics page of my website http://chess-instructor.com, I’m using an iframe to display a javascript-based chess app.

    How can I leverage your framework so that when my website is being viewed on an iphone or android device, I can display a smaller view of the app?

    I was envisioning something like the following code, but it doesn’t work:

    <script type="text/javascript">
    var uagent = navigator.userAgent.toLowerCase();
    if (uagent.search("iphone") > -1) {
       document.getElementById('myiframe').src = "/chess-puzzles/demo-tactic-training-280.html";
    else
       document.getElementById('myiframe').src = "/chess-puzzles/demo-tactic-training-400.html";
    }
    </script>

    I would appreciate your guidance and assistance.

    Thank you!
    Cesar R

    #61367
    Sakin
    Keymaster

    @Cesar R: Sorry this is not directly related to theme and I am not aware of script that you are using to support your code. Your Tactics should have responsive embed code then it will be fine. But when I check your page, it is using fixed height and width embed code. So, you need to get help from that code provider.

    #61413
    Cesar R
    Participant

    Hi Sakin,

    I don’t think I worded my question appropriately. The theme obviously has code that detects whether the website is being displayed on a mobile device.

    I was wondering if there is a way to hook into that code so that I’m able to display an appropriate sized version of the tactics app?

    I’m currently working on updating the code so that the app can resized or perhaps responsive.

    Does that make sense?

    Thanks again for your services!

    #62242
    Cesar R
    Participant

    Hi Sakin,

    I was able to customize the javascript being used for the diagrams, so that it is now responsive. The diagram is looking good on all devices.

    Thanks for your response as I was thinking that by customizing the theme I would be able to achieve this effect. But it is clear now I needed to adjust the diagram code.

    Cesar

    #62684
    Sakin
    Keymaster

    @Cesar R: Yes, you are right and thanks for understanding. Cheers 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Manipulate iframe src based on type of device’ is closed to new replies.