jquery - loading external file with css intact? -


I am working on a project where the client wants to load the current page in a single page dynamically. This is not a problem, but the style is not working when this page loads into standalone files on the existing site. Is there a way to remove the CSS link from each page and it has been dynamically applied to the viewer's page?

Here I have a copy of the function that I wrote to place the external page in the viewer's page:

  $ (function () {$ ('a. Dock-item2 '). Click on an anchor (function () {// dock-item 2 square $ ("# page") .remove (); // already has var href = $ (this ) .attr ('href'); // External file path and name $ (press "& lt; div id =" page "/>;). Load (href, function () {// create a new div And load // page content $ (this) .away () // stuff just to make a good transition ... .app EndTo ('# viewer'). FadeIn (1000);}); return false;}}});  

I want to strictly implement the div in the question ... but maybe this is not the best thing to do. Should I consider this stuff instead of loading it in an iframe? Maybe it's just Friday and I can not think wisely anymore ...

Thanks in advance for help / advice! It is difficult to find non-body tags (tags that are not present within the body) from remote pages /

It is impossible with jQuery's AJAX features being said, if so, you can install a PHP script locally to work as an intermediate person. It can read the contents of the page, get a CSS file, and then it can return or even return the contents of the CSS file - you can keep it dynamically on your page. It should not be very difficult, especially if you have & lt; Script & gt; To capture the tag, something like phpQuery or PHPSimpleHTMLDOMParser, which is similar to phpQuery.

All hypothetical, but it can only work;) Of course if you just wanted to load the IORs, then you could. This will keep all links running within the iframe.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -