Support » Fixing WordPress » Embedding an external site into wordpress

  • How’s it going there!
    I have something here that I hope someone here would know how to steer me onto the right track!
    I’m looking to embed an external site onto this page here to act as the specs page for our site which will be hosted externally on squarespace as in theory that is more user friendly to update for the team here.
    I’ve tried myself using online guides to do it myself using iFrame code but I get keep getting this error
    Screen 1
    which just redirects me to the contact us page

    Anyone have any tips on where I can go from here?

    • This topic was modified 7 months, 3 weeks ago by  Jan Dembowski. Reason: Moved to Fixing WordPress as this is not a Developing with WordPress topic

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Harry Jackson

    (@harryjackson1221)

    Hello bytesizekieran!

    Reviewing your page, it seems you are using https://google.ie as the source, and I believe that may be part of the reason your iframe is not working. I have created an iframe using the following code, and an HTML site as the source, and it is working within the WordPress editor:

    <iframe src="//harryj.us" width="100%" height="800px" frameborder="0"></iframe>

    I could not get it working with google.ie, or .com for that matter.

    I also noticed within your source code, that the iframe tag itself has curly quotes, rather than the straight up and down ones, so you may want to switch to the text editor for adding that code, and not the visual tab, to keep that from occurring.

    I hope this helps you accomplish what you are looking for.

    -harry

    Moderator bcworkz

    (@bcworkz)

    The google.ie server sends a x-frame-options: SAMEORIGIN header, which means browsers will not display content from this server embedded in an iframe unless the page with the iframe is from the same origin as google.ie content. In other words, you cannot embed content from this site inside of iframes, the site does not allow it.

    The harryj.us server does not send such a header, so iframe content is displayed. However, if the server did send a SAMEORIGIN value, and Harry tested his iframe from the same server, the SAMEORIGIN value would allow it, but if we did the same iframe test from our servers, the request would then still fail.

    The curly quotes Harry mentions often creep in when copying code from sites like this one where simple straight quotes get styled into curly quotes on output. It’s just something you need to watch out for when copying code from the ‘net. In these forums, using backticks or the code button prevents the curly quote conversion. Always do this when posting code in these forums 🙂

    Cheers for the help, this site is indeed on Premium Plan and I’ve found where they had the previous embeded site working

    Using the below code

    <?php
    
    	/*
    		Template Name: Specs
    	*/
    
    get_header(); 
    
    ?>
    
    <div class="section-row specs"> 
        <div class="max-container">
        	<h1>Specs</h1>
            
            <div class="breadcrumb"><a href="/" title="back home">Home</a> / Specs </div>
    
         </div>
         
    
         <div id="frame-holder">
         	
         </div>
         
         <script>
    	 	var frame_url = 'https://sites.google.com/a/rte.ie/digitaladspecs/',
    			elemen = document.getElementById('frame-holder');
    	 
    	 	if(window.location.hash){
    			var url_hash = window.location.hash.substr(1),	
    			
    			url_hash = url_hash.replace("+", "/"); 
    			
    			frame_url = frame_url+url_hash;
    		}
    		
    		elemen.innerHTML = '<iframe id="rteframe" src="'+frame_url+'" width="100%"></iframe>';
    	 </script>
        
    </div><!-- END .section-row; -->
    
    <?php get_footer(); ?>

    Got access to the FTP and updated with a new google site link and now the page is appearing blank.
    https://sites.google.com/rte.ie/specs/

    • This reply was modified 7 months, 3 weeks ago by  bcworkz. Reason: code fixed, otherwise syntax errors occur with testing
    Moderator bcworkz

    (@bcworkz)

    What did I last say about posting code in these forums? 😛
    Without backticks, your template code requires major editing before anyone can test it for you. I fixed it up for you so it’s testable as-is.

    Your template works fine on my site, the embed appears correctly. Check your error log, there may be a conflict with your theme’s header or footer templates.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Embedding an external site into wordpress’ is closed to new replies.