How to Block inspect element on browser - inspect-element

Can I block inspect element on browser ?
I want to block inspect element on my webpage, when a user try to modify code in inspect element, he could not do that.

Why would you want to do that?
No, it is not possible. Your server is sending a response on a request, the browser is just an interperter of the code (HTML, CSS, JavaScript) it receives. This means that this code will have to be sent to your computer. When it leaves your server you have no influence on it anymore.

Related

How to retrieve the height of the selected HTML element using Golang?

I was using goquery to parse HTML and I need to retrieve the height of these HTML elements but goquery doesn't have a jquery like .css() method? How can I achieve something like this?
You can't. Jquery runs in the browser where the HTML document is rendered and dimensions (such as height) are calculated by the browser, and are available to Javascript code.
Note that you can't access the rendered dimensions, because the document is not rendered. This doesn't mean you can't access the static attributes (e.g. height) of the HTML tags, but there is absolutely no guarantee that this value will be the actual height of the element.
Goquery runs outside of your browser, where the HTML document is not rendered, and as such, dimensions are not available.
If you want to do it in Go, the HTML document must transfer this information to your Go app (server) e.g. via an AJAX call, or you must run your Go code in the browser, for which there are gopherjs and the Go web assembly target.

Is there a way to load full HTML code without iFrame?

I am writing a preview function to let user preview the HTML file they uploaded and do some minor editing. The HTML file will contain no Javascript and no external CSS. All CSS are either inside style tag or inline. Images, on the other hand, will always be external as we don't provide space for storing images.
iFrame is not a good solution, because:
The preview is before actually saving the content, so I cannot provide an URL for iFrame to load the page.
It is difficult to touch the element inside iFrame. As the user will be doing minor update in another text box showing the plain HTML, I will need to update the elements inside frequently.
However, if I just insert content into an <div> the repeated <html>, <head> and <body>tag will crash the page.
So, is there a way I can preview the HTML without iFrame?
if you dont want to have the main app to affect the styling of the preview, you need to use iframe. have you see iframe's content window? https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/contentWindow. this might be the answer you are looking for. So basically here you try to access the DOM of your iframe. give it a try!
preview = getYourIframeDom();
code = getYourHtmlCodeHere();
preview.contentWindow.document.open("text/html","replace");
preview.contentWindow.document.write(code);
preview.contentWindow.document.close();

Why does Chrome show nothing but div tags when I view the dom elements for an Ext JS app?

I thought some of the Ext JS objects would translate directly into non-div html tags. Why is everything a <div> in element view when viewing my app in debug mode? I never see any <button>,<img>,<a> or any other usual html tag.
For clarification:
Here is for example how the textfield looks like. Inside of all divs, tables, etc. there is input component. Use a "magnifier" tool to fined precise a component that you are interested in.
What is actual the question or problem?
Actually all this divs are wrappers for positioning and styling. To see initial components go deeper in divs. Actually it's nothing to do with chrome. Moreover there is some error in console, it can also be the reason why component wasn't rendered completely.

Browser not rendering anchor tag inspite of being part of Page source

This is yet another confusing issue in HTML. I've an anchor tag, which I build dynamically from server side using java. The tag is viewable when I do view source, but it doesn't show up in the browser. Even when I do inspect element, I don't see it. My question why is the tag not being rendered inspite of being part of page source. Following is the tag:
Maybe you need to add some sort of timeout in Java when creating <a> tag, just like timeout or delay in JavaScript. Based on information you provided, I cannot help you more.

Apply parent style to page in frame

Is there any way to apply the CSS of a parent page to a page within a frame without adding another http request in the page in the frame? Is this possible or would I have to add the CSS via http request in every page loaded in the frame? In the case that it wouldn't work, would it be more convenient to use style tags or link rel if each page were to have a unique CSS? I ask this because they're pages from my site which are only made to contribute to the parent page which has them in frames. The reason for frames being that there is more going on in other areas of the page and everything acts in unison; it'd be convenient not to reload everything for one section.
Set up your cache control headers right and using a <link> will fetch the CSS from the browser cache and not from the server.
No, you would have to put a link element in the iframe's source, which would
1) trigger a new http request
2) it wouldn't work on cross domain websites, because
a) XSS (en.wikipedia.org/wiki/Cross-site_scripting)
b) you would likely not have access to the source to edit it, because it's on a different server.
lists like these are fun. you should try making some of them :)