472,139 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,139 software developers and data experts.

Why won't SRC work?

59
Hi
I am trying to run an external javascript that is on one of my other systems

When i view the source of the page the code i see is
Expand|Select|Wrap|Line Numbers
  1.  
  2. <SCRIPT language="JavaScript"> 
  3. document.write('<iframe width="400" height="200" allowtransparency="true" scrolling="no" frameborder="0" hspace="0" vspace="0" src="/websnips copy/index.php/widget/show/aHR0cDovL3d3dy5iYmMuY28udWsvbG9uZG9uL25ld3Mv/156"></iframe>');
  4. </SCRIPT>

I am trying to create a document like this
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" src="http://localhost:8888/websnips%20copy/index.php/widget/widget/aHR0cDovL3d3dy5iYmMuY28udWsvbG9uZG9uL25ld3Mv/156"></script>
  2.  
Which should embed the script above it, but it doesn't. Can anyone help me fix this problem?

Thanks
Nov 16 '08 #1
3 1096
Markus
6,050 Expert 4TB
The .js file doesn't need <script ...></script> inside it: just the javascript code. Also, the src attrib should point to an actually .js file, I believe.
Nov 16 '08 #2
ojsimon
59
The .js file doesn't need <script ...></script> inside it: just the javascript code. Also, the src attrib should point to an actually .js file, I believe.
Problem is that it is an automated file and does not have any . extention so i need to define it as js?

Thanks
Nov 16 '08 #3
Markus
6,050 Expert 4TB
Problem is that it is an automated file and does not have any . extention so i need to define it as js?

Thanks
Well, the file that is output needs a mimetype that is equivalent to text/javascript. Maybe you can use something like php to get the contents of that 'automated file' and output it to the browser between <script> tags.

Also, the language attribute is deprecated (ie don't use it). Use type="text/javascript" instead.
Nov 16 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

16 posts views Thread by Kerry Neilson | last post: by
1 post views Thread by Jim | last post: by
7 posts views Thread by simon | last post: by
11 posts views Thread by John Ortt | last post: by
7 posts views Thread by Eran.Yasso | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.