0

I want a HTML page to be displayed within a DIV using jQuery. The following code isn't working ?

$("tutorials .t").load("/path/path/cs_regular_tuts.htm")
5
Contributors
11
Replies
38
Views
3 Years
Discussion Span
Last Post by Siberian
Featured Replies
  • 1

    If you look at your browser's console (dev tools), you are going to see this error: `No 'Access-Control-Allow-Origin'` if you are trying to load content from a different site, your browser isnt going to load the data unless the target site allows it. The target site controls that by adding … Read More

0

I corrected the mistake, although no html page continues to loads in the div ? Is the syntax correct ?

0

Maybe the path you are using isnt correct? Use your browser's console to see if there are errors, such as a 404 which means "not found".

if there is no error, check your jQuery selector to make sure its correct. "#" - used for IDs, "." - used for classes.

0

.load doesn't prevent me from using a site address that doesn't end in .HTML rather .com ?

0

I am not sure what you mean. But the example you provided above means that the content is on your site at this path from the root:

/path/path/cs_regular_tuts.htm

Root folder --> \path --> \path --> cs_regular_tuts.htm

0

I know but I'm doing a test with a .com web site, google to be exact, I will be officially loading a html file, I want to do a test with a simple .com web site.

0

Pritaeas - ?

I changed my google.com example URL to a relative path html file, but I don't see anything showing in the div :(

0

By the way, use another website for the check: Google doesn't allow to be embedded into external frames and if you load the javascript console, you'll see the reason:

Refused to display 'https://www.google.com/?gws_rd=ssl' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'

It depends on the X-Frame-Options header. Whenever a website uses this with value SAMEORIGIN then an external frame will not work. More information here:

Bye!

1

If you look at your browser's console (dev tools), you are going to see this error: No 'Access-Control-Allow-Origin'

if you are trying to load content from a different site, your browser isnt going to load the data unless the target site allows it. The target site controls that by adding the appropritate value for the Access-Control-Allow-Origin header

0

JorgeM - I don't get the error you described, instead I get the following error related to another script; SyntaxError: identifier starts immediately after numeric literal ?

Edited by Siberian

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.