NAVIGATION
This shows you the differences between two versions of the page.
|
deutsch:andere-erweiterungen:fremder-inhalt-von-phpwcms [2012/04/09 11:14] Claus |
deutsch:andere-erweiterungen:fremder-inhalt-von-phpwcms [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 102: | Line 102: | ||
| <code js> | <code js> | ||
| - | if(typeof load_remote_css == "undefined" || load_remote_css == true) { | + | if(typeof load_remote_css == "undefined" || load_remote_css == true) { |
| - | var css_link = document.createElement('link'); | + | var css_link = document.createElement('link'); |
| - | css_link.type = "text/css"; | + | css_link.type = "text/css"; |
| - | css_link.rel = "stylesheet"; | + | css_link.rel = "stylesheet"; |
| - | css_link.href = "http://www.example.com/my.css"; | + | css_link.href = "http://www.example.com/my.css"; |
| - | document.getElementsByTagName('head')[0].appendChild(css_link); | + | document.getElementsByTagName('head')[0].appendChild(css_link); |
| - | + | ||
| - | var load_remote_css = false; | + | var load_remote_css = false; |
| - | + | ||
| - | } | + | } |
| </code> | </code> | ||
| + | |||
| + | ==== Das passende JS vom anderen Server laden: ==== | ||
| + | Von OG: Forum: [[http://forum.phpwcms.org/viewtopic.php?f=28&t=22654&start=15#p141854|remote CSS in den HEAD-Bereich injizieren]] \\ | ||
| + | <code js> | ||
| + | if(typeof load_remote_js == "undefined" || load_remote_js == true) { | ||
| + | var js_script = document.createElement('script'); | ||
| + | //js_script.async = 1; | ||
| + | js_script.src = "http://www.example.com/my.js"; | ||
| + | document.getElementsByTagName('head')[0].appendChild(js_script); | ||
| + | var load_remote_js = false; | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | |||