ojsimon Posted October 12, 2008 Share Posted October 12, 2008 Hi this javascript is generated by my code document.writeln('<head><style>a{color: white; font-size:10px}a:visited{color: white; font-size: 10px;}</style></head><table><tr><tr BACKGROUND="http://localhost:8888/sitewidget/app/webroot/img/border.png"><th><font face="Verdana, Arial" size="4" color="white">Widget</font></th></tr><tr><td><style type="text/css"><!--#frame1 { width: 400px; height: 200px; border: none; background: white;}--></style><iframe src="/sitewidget/index.php/widget/show/aHR0cDovL3d3dy5iYmMuY28udWsvbG9uZG9uL25ld3Mv/156" name="frame1" id="frame1" scrolling="auto" frameborder="0"></iframe>');</td><tr><tr BACKGROUND="http://localhost:8888/sitewidget/app/webroot/img/border.png"><th><font face="Verdana, Arial" size="20px" color="white" vlink="white"><a href="/sitewidget/index.php/grab/check/aHR0cDovL3d3dy5iYmMuY28udWsvbG9uZG9uL25ld3Mv/156" target="_blank">Get this widget</a></font> <font face="Verdana, Arial" size="2px" color="white"> |</font> <font face="Verdana, Arial" size="20px" color="white" vlink="white"><a href="http://www.websnips.com" target="_blank">Make a widget out of any site</a></font></th></tr></tr></table>'<!-- 0.1254s --> I am trying to run it like this <html> <SCRIPT LANGUAGE="JavaScript" SRC="js.html"> </SCRIPT> </html> I do not know why it is not running as an external file when it is running when you run the file directly? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/128110-whats-wrong-with-this-javascript/ Share on other sites More sharing options...
RichardRotterdam Posted October 12, 2008 Share Posted October 12, 2008 why are you trying to include an html? ??? thats what server side languages are for that or a remote ajax call Quote Link to comment https://forums.phpfreaks.com/topic/128110-whats-wrong-with-this-javascript/#findComment-663442 Share on other sites More sharing options...
ojsimon Posted October 12, 2008 Author Share Posted October 12, 2008 sorry, i dont understand, i am not including an html? basically the js script runs directly but when you try to run it through an src it does not work Quote Link to comment https://forums.phpfreaks.com/topic/128110-whats-wrong-with-this-javascript/#findComment-663444 Share on other sites More sharing options...
ojsimon Posted October 13, 2008 Author Share Posted October 13, 2008 can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/128110-whats-wrong-with-this-javascript/#findComment-664101 Share on other sites More sharing options...
Psycho Posted October 13, 2008 Share Posted October 13, 2008 I think you need to provide more information. Are you saying that you have server-side code that is writing that first block of code into an external file names js.html? I would agree with Kat, whay are you dynamically creating JavaScript to create variable content. Just use the server-side code to write that dynamica content directly. Quote Link to comment https://forums.phpfreaks.com/topic/128110-whats-wrong-with-this-javascript/#findComment-664179 Share on other sites More sharing options...
ojsimon Posted October 13, 2008 Author Share Posted October 13, 2008 problem is i want to acess it on an extenal domain meaning that SCR is the only way to access it without iframes. Thansk Quote Link to comment https://forums.phpfreaks.com/topic/128110-whats-wrong-with-this-javascript/#findComment-664188 Share on other sites More sharing options...
RichardRotterdam Posted October 15, 2008 Share Posted October 15, 2008 if youre trying to include a external js file yes that would be the right way but it should look like this. <script type="text/javascript" src="some_file.js"></script> but i see you're trying to include an html file. if it is suppose to be a html file then a iframe would be the way to do this <iframe src="http://www.site.com/some_file.html"></iframe> and if you really don't want a iframe you could solve it with php using fopen or curl Quote Link to comment https://forums.phpfreaks.com/topic/128110-whats-wrong-with-this-javascript/#findComment-666111 Share on other sites More sharing options...
Psycho Posted October 15, 2008 Share Posted October 15, 2008 It doesn't matter what the extension is for a javascript include file. It can be 'js', 'html', 'xyz', 'php' or none at all. I have used 'asp' and 'php' when the include file needed to be dynamic. Although for just plain old consistency 'js' would be best. But, that would not explain the OPs problem. I would try accessing the include file directly (i.e. typing it into the browser) and downloading hte file to your PC. Then open it up in a text editor and confirm it is correct. Quote Link to comment https://forums.phpfreaks.com/topic/128110-whats-wrong-with-this-javascript/#findComment-666202 Share on other sites More sharing options...
RichardRotterdam Posted October 15, 2008 Share Posted October 15, 2008 hmmm true i have seen the .php extention a couple of times for script inclusion but that was a php that generated javascript. however i do believe he is trying to just perform an remote include a some html from a remote page Quote Link to comment https://forums.phpfreaks.com/topic/128110-whats-wrong-with-this-javascript/#findComment-666236 Share on other sites More sharing options...
Psycho Posted October 15, 2008 Share Posted October 15, 2008 As long as the "html" file only included javascript code it is not a problem. That's why he/she should download that external file and make sure it is properly constructed. Quote Link to comment https://forums.phpfreaks.com/topic/128110-whats-wrong-with-this-javascript/#findComment-666272 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.