Embedded post javascript stopped working in 4.2.3
-
All of my embedded javascript within posts stopped working in 4.2.3. I have it embedded as noted in the codex here.
The format is:
<script type="text/javascript" src="/scripts/updatepage.js"></script> <script type="text/javascript"> <!-- updatepage(); //--></script>If I make an HTML file with this same code and open it in the root of the same web server, the javascript runs fine. So something in 4.2.3 seems to have broken javascript embedded in posts. I believe it was working before 4.2.3.
-
Never mind. It seems to be a different issue. I’ve tried other embedded post javascript, and it works ok, so something seems to be wrong with my javascript.
Ok, I take that back. It seems that I cannot call a function in an external javascript file (i.e. updatepage.js). The function does not run when called in the post.
All embebed Javascript into pages or posts are destroyed by 4.2.3. In some case change [ or ” by html code, other truncate the code, etc.
So are you experiencing the same problem?
I have the same problem. The embedded javascript no longer functions.
Despite it feeling good to know that people are experiencing the same problem, it doesn’t help much to have people jumping on the thread saying “me too”.
@hesadanza, Please link to a page with the problem.
У меня тоже перестал втоматически запускаться Javascript, который открывает виджет Твиттера на странице сайта.
Это случилось после автоматического обновления WordPress 4.1.6
Пришлось обновиться до WordPress 4.2.3, обновила все плагины, все лишние удалила , но ничего не помогает
Ссылка на страницу, где виджет Твиттера много лет благополучно запускался http://tvoy-internet.ru/eto-vam-pomozhet/motivatsiya-na-segodnya/Аналогично не запускаются на сайте скрипты по запуску презентаций – тоже много лет было все ок. Пример страницы
http://tvoy-internet.ru/prezentatsiya-microsoft-powerpoint-ili-slayd-shou-dlya-sayta/
Вторцю ссылку не пропускают в сообщение. Увы.
Выводится только ссылка, а окно с презентацией или виджетом Твиттера на сайте не открываются.People please open your own threads: https://wordpress.org/support/forum/how-to-and-troubleshooting#postform
Sure. Here’s a page with the problem.
http://www.mormoninterpreter.com/test/Simple page that calls one function test() from test.js. test() never gets called, which should invoke a window alert. See the js here.
It is working, it’s not firing for some reason.
Do you have another example of the real code you were trying to use?
If I don’t put the javascript inside a function, it fires. When it is inside a function, the function is not called.
The “real code” I was using is much more complex, with obfuscated javascript.
http://www.mormoninterpreter.com/books/volume-4-of-the-critical-text-of-the-book-of-mormon-analysis-of-textual-variants-of-the-book-of-mormon/part-one-1-nephi-1-2-nephi-10/That is why I simplified it to the test page. The test() function doesn’t fire.
Here is the javascript that should be running in the real code:
http://mormoninterpreter.com/test.htmlBut the function doesn’t fire inside a WP post/page.
How were you adding your JS before the update, in the same HTML comment?
The topic ‘Embedded post javascript stopped working in 4.2.3’ is closed to new replies.