javascript - Load all <script> tags from a different page -
i'm hooking separate page (same domain) , pulling current page using $.load
, fine, if doing whole page, i'm not, i'm doing javascript code in page. wondering if it's possible load script tags said page current page?
i'm using below code:
var newmessageurl = $('#lnkcompose a').attr('href');
$('#hiddenscriptload').load(newmessageurl);
is said page on same domain or have access it? run trouble cross domain origin policy otherwise. if have access, way parse html using regex statement or html parser , pull scripts manually. sounds hacky approach though , i'm not sure why you'd want this.
if have access, page contents , use below script tag sources.
text.match( /<script src="scripts\/(.*?)\.scripts\.js"><\/script>/g )
Comments
Post a Comment