Hi im demonstrating the html tags that are new in CSS3 and I'm making a documentation for the easy viewing and interpretation on comparing both the source code and the output.And its its really hard for me going to the source code and then selecting the file and browsing it on the browser
It would be great if I could view both the source code and the output
on the same html page.
For example(I m talking from the page I ve attached below) if I select Source code the source code must be displayed on the screen or from any of the text editors.
I don't know whether it is possible to do so,If possible it would be great
if anyone of you could guide me.
To get the source of just one element, do this:
HTML: <div id="one"><span id="two"></span></div>
JS:
document.getElementById('one').innerHTML // returns <span id="two"></span>
document.getElementById('one').outerHTML // returns <div id="one"><span id="two"></span></div>
To get the source of the entire page, do this:
document.doctype + document.documentElement.outerHTML
document.doctype returns the doctype, and document.documentElement.outerHTML returns the code for the <html> tag and everything inside it.
Use the developer tools you have in all modern browsers (the most advanced ones being Chrome and Firefox).
You typically open such a toolset using the Ctrl-Uppercase-i shortcut.
Then you have a lot of useful tools, as described here for Chrome or here for Firefox.
One of them seems to be exactly what you need. For example in Chrome, the first tab, called "Elements", shows you the source code with a lot of goodies (interpreted css with reasons, element displayed when you hover the mouse, search, etc.).
I'd suggest you take the time to read the linked documentation, as this is an essential tool of any web developer. And you won't be able to stop using those tools as soon as you go deeper in javascript or css.
Related
click this links to see the screenshots
full source code of the home page
source code of the external file
full source code of the home page (in google chrome inspect
view)
full source code of the home page (in google chrome page source
view)
I have been keeping the code indentation in that web pages from the beginning in my code editor. but when i see my site on google chrome, the indentation is not set properly. can I know why is this? I googled this, yet coudn't find an answer or a solution.
It is not Google Chrome's fault. Your files simply get compiled to this form, the browser displays them exactly as they look like.
But why they look like this? In your case PHP's include does only purely textual replacement, as in the picture bellow:
The effect is the same as if you copied the contents of the external file and pasted them to the main file, replacing the include tag.
If you would really insist on having the code indented properly after the include does its job, you would have to add new spaces at the beginning of each line (but first) of the included file. It would shift the text to the right (in this case 4 spaces) and in the result the indentation would be preserved.
However, I'd discourage you from doing so -- it is only the code that is generated, probably no one is going to work with the compiled result. Proper formatting of code is only meant to make the human work easier -- it has no effect on how the page will eventually look like, when rendered by browser. Thus, it probably would suffice if you kept the two source files formatted as they currently are and left the output as is, even though it is not indented well.
If you'd like to have the code properly formatted in the page source view, please remember that you can simply use the "pretty print" button in the lower left corner of the preview:
I've got a simple MVC web page that pops up a dialogue box with a list of hyperlinks to files. They're properly prefixed with "file://" and the links work properly if copied to the clipboard and pasted into a browser window. However, from within the dialogue, clicking on the linked files returns... nothing.
Nothing at all happens. The behavior is identical in Firefox, Internet Explorer, and Chrome. No warnings, errors, etc.
Visually my dialogue looks like this:
If I "inspect element" on one of the links, for example, the top one for "javascript notes.txt", it looks like this:
This IS a valid hyperlink. As mentioned above, I can copy the link into the address bar of a browser and the linked file opens fine. I can also copy the full HTML of the element into notepad, wrapped in tags and save as an .html file, and the link works just fine from there. The links just don't work in the dialogue--from any browser.
I'm displaying the links in a Kendo grid currently. Thinking that might be a problem, I got rid of the grid temporarily and tried displaying them in a plain HTML . Same problem--clicking on the links produces no result at all.
Am I fighting something deeper here? Like, I'm using a jquery dialogue to show the list. do jquery dialogues do something to block hyperlinks from working?
TIA for any help.
As per Amy's comment on the original question, browsers seem to block the file:// links when opening from a page retrieved via http. The workaround I implemented came from the excellent article linked below: I coded a simple action method in a controller that returns not a view but a File, and changed the hyperlinks to invoke that controller method via http. Works like a charm.
see: http://rachelappel.com/upload-and-download-files-using-asp-net-mvc/
First: I know you should not use href javascript: to put javascript o a link. It is bad practise and all I can find on the forums is don't use it and questions regarding this are rejected. But I am not generating the html. It is salesforce who is generating html and I suppose they don't know better.
Now this is not working in Firefox and IE. Only in chrome. The strange thing is that if I try to write the same href in a test html page all 3 browsers seem to happily execute the javascript following the javascript: so it is not that is not supported by all browsers.
However with the visual force page embedded in the lightning interface such links no longer work. So I was wondering if there is anything I could investigate or do to get these working so any general information about why such links would not work or more specific why salesforce would be doing this for VF pages in the lightning interface could help me.
Such links are generated with the
<apex:outputLink target="_top" value="{!UpdateLink}">/apex:outputLink>
and to check that such links do not work when embedded in the lightning page I inserted the following snippet of html both in my VF page and in a blank html page
<script type="text/javascript">
function DebugClick ()
{
alert ('click');
return false;
}
</script>
debugger
In the html page it works in all three browsers. In the VF page it only works in chrome.
I also forced a break in the code and inspected the code using javascript to see if either the href attribute or the onclick of the link were changed but they seem intact. Here is my console output copy where I inspected the actual link not working, not my test link
window.getElementByIdCS('j_id0:j_id1:j_id2:updatelinkpnl').childNodes [0].onclick
null
window.getElementByIdCS('j_id0:j_id1:j_id2:updatelinkpnl').childNodes [0].attributes ['href']
href="javascript:srcUp('https%3A%2F%2Fbvdep.na5.visual.force.com%2Fapex%2FBvDAccountLink%3Faction%3DUpdate%26id%3D0017000001THUbxAAH%26objType%3DAccount%26product%3Dorbisneo%26isdtp%3Dp1');"
I finally cracked it (and see more or less where it is coming from) so here is for anyone encountering a similar issue what seem to be the key factors.
The is in an iframe. And the target is _top. I know this is a strange combinbination, but the original url was a simple link that needed the top target. It is only the lightning interface that substituted this to use javascript but doesn't remove the top.
Apparently IE and firefox then refuse to execute it. It might be that some security policy headers are part of the equation, but since I found a solution (make the target=_top dependant on the inteface I had no need to search further
I am trying to create a scraper using vb6, my technique is to search the html page with get between 2 text function.
the function is tested and working correctly for all the sites, except a new site that I tried to use the same technique with it and failed.
The problem is the html is not showing the data, piece of the html as below:
<tr>
<td valign="top" nowrap="nowrap" class="label">Company Name:</td>
<td><span class="search-custom" id="synopsisDetailsOppNum"></span></td>
</tr>
the value should appear between the span tag above, but it's not appeared inside the HTML as above code.
The website is using javascript to manage the data.
I have tried also to use wait function, may the data appear with the HTML, but failed too.
Is there any solution to get the value, even with vb.net as I can update my code
that website is using JavaScript to add data to the webpage and such manipulation will not show up on the page source
The follwoing is quoted from JavaScript & jQuery: The Missing Manual by David Sawyer McFarland
One problem with using JavaScript to manipulate the DOM by adding,
changing, deleting, and rearranging HTML code is that it’s hard to
figure out what the HTML of a page looks like when JavaScript is
finished. For example, the View Source command available in every
browser only shows the web page file as it was downloaded from the web
server. In other words, you see the HTML before it was changed by
JavaScript, which can make it very hard to figure out if the
JavaScript you’re writing is really producing the HTML you’re after.
For example, if you could see what the HTML of your page looks like
after your JavaScript adds 10 error messages to a form page, or after
your JavaScript program creates an elaborate pop-up dialog box
complete with text and form fields, it would be a lot easier to see if
you’re ending up with the HTML you want. Fortunately, most major
browsers offer a set of developer tools that let you view the rendered
HTML—the HTML that the browser displays after JavaScript has done its
magic. Usually the tools appear as a pane at the bottom of the browser
window, below the web page. Different tabs let you access JavaScript
code, HTML, CSS, and other useful resources. The exact name of the tab
and method for turning on the tools panel varies from browser to
browser: • In Firefox, install the Firebug plug-in (discussed on page
477). Open a page with the JavaScript code you wish to see and open
Firebug (Tools→Firebug→Open Firebug). Click the HTML tab in the
Firebug panel, and you’ll see the complete DOM (including any HTML
generated by JavaScript). Alternatively, you can use the Web Developer
toolbar in Firefox to view
both the regular HTML source, and the generated HTML. • In IE 9, press
the F12 key to open the Developer Tools panel, then click the HTML tab
to see the page’s HTML. In the case of IE9, the HTML tab starts by
showing the downloaded HTML (the same as the View Source command). But
if you click the refresh icon (or press F5), the HTML tab shows the
rendered HTML complete with any JavaScript-created changes. • In
Chrome, select View→Developer→Developer Tools and click the Elements
tab in the panel at the bottom of the browser window. • In Safari,
make sure the Developer menu is on (choose Safari→Preferences, click
the Advanced button, and make sure the “Show Develop menu in menu bar”
is checked. Then open the page you’re interested in looking at, and
choose Develop→Show Web Inspector. Click the Elements tab in the panel
that appears at the bottom of the browser window. • In Opera, choose
Tools→Advanced→Opera Dragonfly. (Dragonfly is the name of Opera’s
built-in set of developer tools.) In the panel that appears at the
bottom of the browser window, click the Documents tab.
so the scraper won't download the page after the JavaScript finished it will get what it looks before any the JavaScript manipulation
you can watch Michael Schrenk talking about Screen Scraper Tricks: Extracting Data from Difficult Websites
http://www.youtube.com/watch?v=NtffxCi8aq4
I have PHP generated HTML.
Firebug shows me this source:
<div class="module-header"><div class="module-header2"><div class="module-header3"><h3 class="module-title" style="visibility: visible;"><span>Մարդկային</span> ռեսուրսներ</h3></div></div></div>
Mozilla Source shows me another HTML for that part.
<div class="module-header"><div class="module-header2"><div class="module-header3"><h3 class="module-title">Մարդկային ռեսուրսներ</h3></div></div></div>
Actually this part should work as link. But doesn't...
Firebug is showing you the actual page content at that exact moment, whereas "Show Source" is showing only the static HTML that got downloaded from the server.
If JavaScript is making any changes to the page, the two will be different. In this case, it looks like JavaScript is removing your link and hiding the h3 element.
I see a style="visibility: visible; in Firebug's source. Are you sure you are not messing with the HTML via Javascript and some .show() .hide()?
Firefox's Source is the way to go for static HTML -> There is no rendering difference from what you see in your browser window and the source you see with Right Mouse BUtton > View Source, but (there always is a but) if you change the source dynamically - e.g. via JS when hovering over one link it hides some other part of the website - the Firefox "View Source" will be wrong and not reflecting these dynamic changes - these you will only be able to see with Firebug.
Maybe you can try a different browser and see if it is working there as a link?
Javascript might interact with your page and could hide the link because of some pre-condition. Maybe you want to turn off Javascript and see if your link is working then?