I am using the method below to load a remote page in a device on this page. <> I'm curious, is it a bad practice to load a fully formatted HTML page into another page? My concern is more to load css or additional javascript, in which the other elements on the primary page can be overwritten. I have not had any problems during my initial tests, I am not sure that this is the best practice. To illustrate: If I have a primary page, and the results.html code that looks like this: Will CSS and JS overwrite each other, or will page 2 serve as separate entities? This will work fine and the browser will handle it properly: However, this is probably the best practice to specify the element in the returned HTML in which you want to insert: $ ('# results') preload ('www.myurl.com/results.html').
& lt; Html & gt; & Lt; Top & gt; & Lt; Script src = "jquery.js" & gt; & Lt; / Script & gt; & Lt; Link href = "myResults.css" rel = "stylesheet" type = "text / css" & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Header & gt; & Lt; H1 & gt; My results page & lt; / H1> & Lt; / Header & gt; ... & lt; / Body & gt;
< P> ... Browsers often filter elements from the document such as
& lt; Html & gt; ,
& lt; Title & gt; , or
& lt; Head & gt; element As a result, the elements obtained by .load () can not be exactly the same, such as the documents were recovered by the browser directly.
$ ('# remoteContainer '). Load ('www.myurl.com/results.html #containerDiv');
No comments:
Post a Comment