C
C
chrome1232015-06-18 20:12:42
JavaScript
chrome123, 2015-06-18 20:12:42

How to measure iframe height in classmates?

Hello.
Tell me how to solve this problem I'm
developing an IFRAME application for OK
There are 2 files index.html And index2.html

<head>
<script src="http://api.odnoklassniki.ru/js/fapi5.js"></script>
</head>
<script>
 
    var rParams = FAPI.Util.getRequestParameters();
 
 
    FAPI.init(rParams["api_server"], rParams["apiconnection"],
        function() {
            alert("Инициализация прошла успешно");
        }, function(error) {
            alert("Ошибка инициализации");
        });
 
    $(function() {
        FAPI.UI.setWindowSize(760, 100);
    });
</script>
<a href="index2.html">Клик</a>

With the help of the code, I change the height and width of the IFRAME when I start the application, the code works fine and the sizes change and an alert is displayed. But when I press Click and go to another file, the code of which looks like this
<head>
    <script src="http://api.odnoklassniki.ru/js/fapi5.js"></script>
    </head>
    <script>
     
        var rParams = FAPI.Util.getRequestParameters();
     
     
        FAPI.init(rParams["api_server"], rParams["apiconnection"],
            function() {
                alert("Инициализация прошла успешно");
            }, function(error) {
                alert("Ошибка инициализации");
            });
     
        $(function() {
            FAPI.UI.setWindowSize(760, 200);
        });
    </script>
    <a href="index.html">Клик</a>

Then the size from 100px does not change to 200px
. And if you click on the link again and go to the previous file, then the code will not work there either. I started looking for an error. And I found that the whole reason is in the file api.odnoklassniki.ru/js/fapi5.js for some reason, a complaint about this piece of code this.webServerUrl.indexOf("://")==-1 Maybe someone had a similar situation, describe how you solved this problem. Also, if you can tell me this method FAPI.UI.scrollToTop allows you to scroll the page to the very beginning, but is there a method that allows you to scroll the page to a certain point, for example scrolling by 5px and so on? and I still can not find a method that would allow changing the title of the window Thank you for your attention

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vjacheslav Kanivetc, 2015-06-19
@chrome123

You have an IFRAME open. Parameters are passed to it. They are used during FAPI initialization.
When you redirect inside your iframe to another html page, you don't pass those parameters to it, so they are lost. So either you need (the choice is yours)
- save the parameters somewhere,
- paste them to the links inside,
- do without a redirect,
- wrap in another 1 iframe already on your part.
The title of the window does not change, scrolling within your iframe is in your hands.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question