www.webdeveloper.com
Results 1 to 3 of 3

Thread: document.createElement

  1. #1
    Join Date
    Oct 2003
    Location
    Pensacola, Fl
    Posts
    149

    document.createElement

    Hi, I just bought Dreamweaver and have been experimenting with JavaScript...I've found that "document.createElement('script')" doesn't work when trying to load an external javascript into an iframe. Specifically, it appears that "document" is deprecated. Does anyone know of something else that might work?
    Your friendly neighborhood Okham. -o-o-

  2. #2
    Join Date
    Mar 2011
    Posts
    1,136
    If you're trying to insert a <script> into a document from an external domain that you're loading into an <iframe>, then you're probably running into browsers' built-in security protection against cross-site scripting. What exactly are you trying to do?
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Oct 2003
    Location
    Pensacola, Fl
    Posts
    149
    Quote Originally Posted by rtrethewey View Post
    If you're trying to insert a <script> into a document from an external domain that you're loading into an <iframe>, then you're probably running into browsers' built-in security protection against cross-site scripting. What exactly are you trying to do?
    Hey Rick, well what I'm doing for now is just local. I haven't been able to write a script to the page in my iframe. Just now I commented all of the lines in this here, and found that they all were accepted except for the last, which is
    Code:
    document.getElementByTagName('head')[0].appendChild(e)
    The whole script looks like this:
    Code:
    <script type="text/javascript">
    	e=document.createElement('script');
    	e.setAttribute('src','items/designs/des0.js');
    	e.type="text/javascript";
    	document.getElementByTagName('head')[0].appendChild(e);
    </script>
    So one step at a time I'm trying to figure out why this code isn't working. It seems straight-forward. Any suggestion you have on it would be great, I'm sure...
    Your friendly neighborhood Okham. -o-o-

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles