0

I want to show external url(like 'https://google.com') in div widthout using iframe. So referenced this.

<div> 
    <object type="text/html" data="http://validator.w3.org/" width="800px" height="600px" 
    style="overflow:scroll; border:5px ridge blue">
    </object>
 </div>

It is working well, but when I change data attr to what I want url(ex: 'https://www.google.com'), it is not working. The area shows nothing. (also, .load() not working)

<div> 
    <object type="text/html" data="https://www.google.com/" width="800px" height="600px" 
    style="overflow:scroll; border:5px ridge blue">
    </object>
 </div>

I use this.

<script src="https://code.jquery.com/jquery-3.4.1.js"></script>

I want a solution to this problem. and if the solution is different in control through jquery, i would like to know that as well. I have been wandering for five hours about this. Please help me.

OMG0606
  • 3
  • 2

1 Answers1

3

The website you want to show probably does not allow this with the X-Frame-Options header:

Sites can use this to avoid click-jacking attacks, ...
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

This is so you cannot simply steal any website and give it a different design, for example.

If you are actually talking about Google and that wasn't just an example, you can use this: programmablesearchengine.google.com/about

Peter Krebs
  • 3,831
  • 2
  • 15
  • 29
  • You are right. I tested it with n-tv.de as start site and heise.de and focus.de as second site. First run did fail, second one did pass. ;-) – Reporter Jun 07 '21 at 12:29
  • Is there any solution? – OMG0606 Jun 07 '21 at 13:02
  • There is no solution if the other website doesn't allow. Again, otherwise clickjacking would be possible. If you want some other functionality from that website except showing it through your own website you can implement an API if they allow it. If you are actually talking about Google and that wasn't just an example, you can use this: https://programmablesearchengine.google.com/about/ – Peter Krebs Jun 07 '21 at 13:08