JavaScript - Block View Source
What is the code to stop people from viewing your source.
Such as this site: http://bad-behavior.com (View The Source of That Site) I've searched the forums, and all I got was a bunch of "nothing can protect your source" I don't care about all of that. I want the code because: 1. Most people don't know how to view a source after it has been blocked 2. I think it's cool Similar Tutorialsrecently i noticed that all of my embedded JavaScript code and external style sheets are being shown IN "view source." this happens in all browsers ( IE, FF, Chrome, and Safari [windows]) ... oddly enough it only happens when viewing on my vista or win2k3 machines. is this something added to these OS's or the result of an installed program? has anyone seen this before? Hi , I made a table that retrieves some Data from the Database also I did some calculations for this data using Javascript and It works fine , but I can't see the calculated values in the source code . That's the Problem , cause I can't print it or export it without these values. and the source code doesnt show it... so , what can I do , to view the generated values from JS in the source code ?? Thanks , I'm afraid this is a task related to my job and I need ur Help Urgently I'm using IE 6 only as a web browser and the Javascript Calculations are functions and Classes in a seperated file and I linked it to the Report page ... How do I hide my javascript from html page (from view source on right click)?
Hi, I'm creating an extension on Firefox that wishes to parse the source of a page that the user is currently viewing for specific information. I've gotten as far as creating a simple extension with a button and when I click on it, it will show the url of the page I am currently viewing through: content.location.href All the examples I've seen so far concerning viewing the source forces you to either use the 'view-source:' convention or the 'xmlhttprequest' method. But these examples seems to be meant to be called within a web page and not an extension. When I cut and paste with these examples, I only get the source for the actual chrome portion of Firefox. I've tried modifying some of the examples to include 'content.document....etc' to reference what's being displayed in the browser, but it doesn't seem to work. Can anyone provide sample or reference code so I can extract the page source of my current window from an extension? Thanks! I have created and opened a new window using Javascript and written to it with the document.write Command. When I click "View" and then "Page Source" (Firefox) to view the source of it, however, it displays a blank page. How can I get the source of a window I created? Thank You Charles Hi - I'm working in ASP.Net 2.0. My page has a GridView control, which is populated by a SQLDataSource. The GridView has one Button control per row. The button has a client-side javascript function (ShowDelete) attached to its OnClientClick event on DataBinding of the GridView. This event fires some javascript. The javascript does 3 things: - It changes the text of the button from "Hide" to "Create" - It changes the background color of the button from red to green - It assigns a new onClientClick event to the button: "ShowAvailable" The text and the color of the button change with no problem. After I change the OnClientClick event, I send an alert with the button's OnClientClick event and it reports it to be "ShowAvailable". However, when I click on the button, it doesn't fire ShowAvailable, it fires the original onClientClick event (ShowDelete). Also, when I do View Source, it shows the button's text, color and OnClientClick event as their original settings, i.e., "Hidden", "Red" and "ShowDelete", even though I'm looking at a green button that says "Create." What's going on here? Here's the code I use to attach the OnClientClick event on DataBinding of the GridView: Code: foreach (GridViewRow row in this.gvLocation.Rows) { if (row.RowType == DataControlRowType.DataRow || row.RowType == DataControlRowType.EmptyDataRow) { int rowindex = row.RowIndex + 1; //to exclude the header which is counted as a row when we get to javascript btnAction.OnClientClick = "ShowDelete(" + rowindex.ToString() + "); return false"; } } Here's the javascript for ShowDelete: Code: function ShowDelete(rowindex) { var locationgridID = '<%= gvLocation.ClientID %>'; locationgrid = document.getElementById(locationgridID); if (locationgrid != null) { action_cell = locationgrid.rows[rowindex].cells[3]; for (k = 0; k < action_cell.childNodes.length; k++) { if (typeof(action_cell.childNodes[k].id) == 'string') { action_cell.childNodes[k].value = "Create"; action_cell.childNodes[k].style.backgroundColor = "Green"; action_cell.childNodes[k].onclientclick = "ShowAvailable(" + rowindex + "); return false"; alert(action_cell.childNodes[k].onclientclick); // reports the OnClientClick event is ShowAvailable } } } } Any thoughts are greatly appreciated! Very new to Javascript (been a HTML/CSS guy for a while, but never really got into more than tinkering with other other people's Javascript coding), but I came across a situation I can't find canned coding for, and trying to create it from bits and pieces I Googled has led me to a dead-end. In summary, I have a website that I frequently visit (FWIW, Firefox 3.x is my browser of choice) with many image sources referring to URLs that end with "-thumbnail.jpg". However, for better image quality, I am trying to use Greasemonkey to replace all instances of "-thumbnail.jpg" in the source of images on this site with "-bigthumbnail.jpg". The closest I could think of was to somehow use getElementsByTagName and innerHTML.replace, but realized that innerHTML does not do HTML, only content. Below is as far as I tried to get on my own, I appreciate any assistance from the folks here to help a JS novice like myself, thanks! Code: (function() { var as,ae; as = document.getElementsByTagName("img"); for (var i = 0; i < as.length; i++) { ae = as[i]; ae.innerHTML = ae.innerHTML.replace(/-thumbnail/gi, "-bigthumbnail"); } })(); Hi, I would like to ask if there is anyway to get a variable from any webpage source using javascript. Something like javascript: document.getelement? Hi, i am very new to this place..so if i make nay mistakes, am sorry. and i am rookie at coding..so i may sound dumb... I wanted to know, if there is any method by which i can get the source code of a webpage in a program by using the URL. what i want to do is that am developing a javascript webpage which requires some info to be taken out of a certain webpage, and in the url of that webpage i can enter the query, so i wanted to know if there was any method to get the source of the webpage and store it in a varabile so i can scan it for the required info. Thanks. In a webpage I am developing I need to change the presentation depending on user selection. At the moment this code is huge and not very maintainable. The first purpose was to have a working code, now I would like to make it more maintainable. Below is a main part of the problem; Code: function myFunction(type) { if (type.value == "1") { var form1 = document.getElementById("OrderForm1"); form1.style.display = "block"; var form2 = document.getElementById("OrderForm2"); form2.style.display = "none"; var form3 = document.getElementById("OrderForm3"); form3.style.display = "none"; } else if (type.value == "2") { var form1 = document.getElementById("OrderForm1"); form1.style.display = "none"; var form2 = document.getElementById("OrderForm2"); form2.style.display = "block"; var form3 = document.getElementById("OrderForm3"); form3.style.display = "none"; } else if (type.value == "3") { var form1 = document.getElementById("OrderForm1"); form1.style.display = "none"; var form2 = document.getElementById("OrderForm2"); form2.style.display = "none"; var form3 = document.getElementById("OrderForm3"); form3.style.display = "block"; } } <div id="OrderForm" style="display: block;"> <div id="OrderForm1" style="display: none;"> <FORM METHOD="POST"></FORM> </div> <div id="OrderForm2" style="display: none;"> <FORM METHOD="POST"></FORM> </div> <div id="OrderForm3" style="display: none;"> <FORM METHOD="POST"></FORM> </div> </div> Basically the myFunction will be called based on user input. This input will show one section of html code and hide other sections of html code. So if input is "1", then OrderForm1 shall be shown and OrderForm2 and OrderForm3 must be hidden. if input is "2", the OrderForm2 shall be shown and OrderForm1 and OrderForm3 must be hidden etc. By adding more forms to show and hide, this code is growing massively. I would like to add some kind of for loop function to this but I am not sure how to loop through the various section names (OrderForm1, OrderForm2 and OrderForm3) and set the appropriate value. Appreciate any help HI , IF there is error in JS then in FF i can see in console window using firebug But i am noe getting script error in IE but i am not able to find where the error is. Is says object required line 499 now i don't understand which script is IE talking about . Is there any way to find error in IE hi- trying to set frame source from javascript- i cant get it to work.. Code: <script> stud = mm_adl_API.LMSGetValue("cmi.core.student_id"); newlink = ('https://blah.blah.blah&stud_id='+stud); // --> </script> <frameset rows="*,80" frameborder="no" border="0" framespacing="0"> <frame src="javascript:window.location(this.newlink)" name="thisname" /> <frame src="bottom.html" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame" title="Scorm Handling" onload="mm_adlOnload()" /> </frameset> Hey. I've been trying to get this page working with dynamically loaded iframe sources passed by URL, but I can't seem to get it working. Here's the relavent code: Code: <script type="text/javascript"> function delineate(str) { URL = str.indexOf("=") + 1; return(str.substring(URL)) } </script> Then there's a form/submit button that simply return the name of a type of item, for example "german" or "french" Using the form attributes method="link" and action="pageURL.html", where pageURL is the page that all of this is on. Code: <form name="hack"><input type="hidden" name="selector" /></form> <script language="javascript"> var url=window.location; document.hack.selector.value=url; var url_select=document.hack.selector.value; var selectedURL="../types/" +delineate(url_select) +".html"; document.write (selectedURL); frames['middleframe'].location.href=selectedURL; </script> <iframe id="middleframe" name="middleframe" src="../types/default.html" width="100%" scrolling="auto" height="1000" frameborder="0" style="display: inline;" /> I used the hidden form to change the url to text - advice from another website. I'm sure there are better ways to do it, but I'll explore them as soon as this thing actually works.. The types are in a subfolder named types, as shown. The document.write was placed in as a debug helper, and it displays the proper file location of whatever I select with the combo box, but the iframe doesn't change it's src to the selected page! I've tired the last line of the last <script> with several different methods, none of them producing any effect whatsoever. What am I doing incorrectly? Any help? Thanks. I am trying to use an external source for my javascript. The source loads with my script but the functions from the external source are not working. I do have it saved as a js file and in the same folder as my assignment. Below is my external source I am trying to use: <html> <body> <script type="text/javascript"> // Convert miles ==> kilometers function milesToKilos(miles) { return miles * 1.609; } // Convert kilometers ==> miles function kilosToMiles(kilos) { return kilos * 0.621; } // Convert miles ==> yards function milesToYards(miles) { return miles * 1760; } // Convert yards ==> miles function yardsToMiles(yards) { return yards * 0.0005682; } // Convert Fahrenheit ==> Celsius function fahrToCels(fahr) { return 5.0/9.0 * (fahr - 32); } // Convert Celsius ==> Fahrenheit function celsToFahr(cels) { return 9.0/5.0 * cels + 32; } // Convert Pounds ==> Kilograms function poundsToKilograms(lbs) { return 0.4536*lbs; } // Convert Kilograms ==> Pounds function kilogramsToPounds(kg) { return kg/0.4536; } </script> </body> </html> Now here is the javascript I am trying to use to run the external source. I can enter information but it is not using the functions from the external source. <html> <center><h2>Conversions</h2></center> <head> <script type="text/javascript" src="conversions.js"></script> </head> <body> <script type="text/javascript"> lbs = prompt ("Enter kilograms to convert", " "); var myFirstVariable ; myFirstVarible = "lbs"; alert (lbs) ; kg = prompt ("Enter pounds to convert", " "); var mySecVariable ; mySecVariable = "kg" ; alert (kg) ; </script> </body> </html> I want to hide my JavaScript but when I checked the FAQ of this forum, I saw that it said that it isn't possible. But how did worldometers.info did it? Because I cant find the JavaScript source. Is it possible to self source a javascript file? I have a file with code that opens a javascript window and document.writes to it. I want to run some code in this file attached to window.onload. Code: function someWindow() { var openedWindow = open(/* relevant vars */); openedWindow.document.write(/*doctype and html head markup*/) openedWindow.document.write("<script type=\"text/javascript\" src=\"(this file)\"></script>"); openedWindow.document.write("<script type=\"text/javascript\">window.onload = function(){ /* sourced code */}</script>") openedWindow.document.write(/*html body markup*/) openedWindow.document.close(); } then in the same file have code defining object constructors and such that attach events to various elements. I realize I can write a long string variable with all the code, but that would be visible a browser window -> view source window ( I know it won't hide the code in a separate source file) The object is to have a widget all in one file, rather than having a separate html, css file and another javascript code file. Thanks for advice, suggestions, encouragement, JK I am fairly new to JavaScript and I have been searching and searching and I cannot get a clear cut answer to my question. Here is what I am trying to accomplish: I want to gather the html source code from a particular sports score site and then store specifics of that resulting html (ie: the actual game scores) as strings, which I will then call in a windows sidebar gadget. Aside from actually getting the source code stored as a string, I would need to know how to then find a part of that string (ie: the text between "Last:" and "</") and store it as a separate variable. From what I have seen online I need to be using XMLHttpRequest... but I am completely lost when it comes to this. Can someone please give me a hand. Thanks in advanced. Please be as specific as possible. I am currently trying to write a javascript function which checks whether the source of an image is one thing, if so do this, if not do something else. Any help is much appreciated. Below is the code I have tried... Code: if(document.getElementById("field").src == "images/tick.png"){ alert("this is the tick image"); } Hi Sorry if the title is a bit vague. I have a single page with fixed background and <A name=section> / #section type menu also have a margin-bottom: 1000px; so content isnt visible until the link in menu is pressed I am using the smooth pack javascript so it scrolls rather than jumps straight to the #section content what I want to do is have the content invisible until it reaches the fixed background is it possible to have content invisible until it scrolls into a div, i'm sure it is the fixed background is about 800x500 and black all round so the text is visible, I could alter to have any text black but at the moment its blue and white If there is no street view available for a specific long and lat on google maps, is there a way to display some kind of message instead of the grey box which google shows? I cant find anything in the API?
|