Disable URL Shortening/ Formatting in Chrome's Console - javascript

I'm converting pages from an old format to new via Snippets. All was right in the world, up until I noticed Chrome's console "shortening" URL's so they would display better.
var url = "http://www.somewebsite.com/this/is/a/really/really/really/really/long/ass/url/that/will/be/cutoff/later/on/just/wait/wait/for/it/wait/for/it/there/here/are/some/query/strings?awwww=snap&this=is&really=happening"
console.log(url);
// Spits out
// "http://www.somewebsite.com/this/is/a/really/really/really/really/long/ass/u…r/it/there/here/are/some/query/strings?awwww=snap&this=is&really=happening"
These aren't the actual URL's, but you get the idea. Is there a way of removing formatting from Google Chrome's console area? This snag pretty much ruined all my plans, hoping to not have to use a headless browser just to get raw text output. :-\

One workaround I found wasn't to log the actual values I was wanting. Instead I set it to a window variable and use copy(window.varToCopy)
copy() is a native Chrome function you can use in the console to copy the data to your clipboard. Luckily it seems that it doesn't format anything you pass into it, so I can then get the actual URL rather than the broken one.
This is only a workaround, hopefully someone knows how to remove console formatting!

My workaround is to use console.dir(url);. It isn't designed for this purpose, but it definitely does the trick:
You can't really open the hierarchical listing, but you don't need to anyway.

I ran into this issue when I had a long array of long urls. Nothing of the above helped.
The solution I finally came up with is:
console.dir(JSON.stringify(urls))

When a URL is displayed in the Chrome Javascript console, there are some context menu (i.e. right-click menu) options to interact with that url. If all you want is to copy and paste the full text of the URL to another location for viewing, you can right-click on the URL in the console and select "Copy Link Address". Then, just paste anywhere - even back into the Javascript console, if you want! - and the full, unshortened URL is there for your viewing enjoyment.
While this doesn't disable Chrome's URL-shortening behavior, it is a more comfortable workaround to me than inserting Chrome-specific Javascript into my code.

I just had the same problem. I ended up using this little workaround, making the url a non-url by removing leading http/https:
console.log(url.replace(/^https?:\/\//,""));

Related

Script In Formula Text Search Result

I have a search result column where I'm using the record ID to pass parameters as a link to a non-netsuite external site I own that is designed for a specific non-NetSuite task.
The link is working great and the formula looks something like this:
'Use Tool'
However, I'd like to add some script to it by using onClick, and each time I've tried this either I get back invalid expression or the script seems to get stripped out of the link.
I've added what should just be a simple alert window with the record id as a test like this:
'Use Tool'
but using the dev tools to inspect this the search result shows up like this:
Use MT Tool With Tracking
I'd like to track something simple like which user clicked the link and what day it was, but I'm starting to think that this might not be possible.
Has anyone ever tried doing something like this before?
Is there a better way to do this?
Thanks in advance for any help.
It may be a rudimentary attempt on NetSuite's part to prevent XSS attempts, but if you don't need to support Internet Explorer you can get around it using the template literal syntax.
'Use Tool'
I still think the escaped double quote is a problem ☺, but I was able to duplicate your issue in preview mode (I think it's a result of NetSuite's whence parameter). Run or Save and Run does not encounter the issue. See screenshots of Search Formula Text fields below and corresponding elements when run.
Lazy Loader
Result
Element

How to set the encoding of an embedded text iframe

I am here asking about document embedding in HTML.
In a project I am working on, I am embedding my update logs as text files directly into my page, with a selection menu to view all the different updates.
The problem I am having, is not really much of a problem, being that they are plain text files, but the Firefox (have not tested elsewhere yet) console spits out a "No character encoding in the iframe document" warning.
I have searched far and wide for a solution to this problem, only to find that every solution is specifically main-level document based, like "put a tag in the html header", which I already have done from the start. I just use this:
<embed id="update_display" src="some_latest_update_file.txt" />
The embed seems to create an iframe, with the text file as the source. This works fine for me, where I am just displaying the updates. But what I am trying to control is the warning, I don't want to see the warning for something stupid like that. I know I can display my updates differently, but I would like to keep the current method if possible.
Is there a way to set the encoding of the iframe, without actually knowing the id or anything about what the embed will create?
It creates an entirely different document within my document, with it's own html, head, body and such tags. I would greatly appreciate any answer for this, as I want to keep my console clean and warning/error free.
I never actually ended up sticking with this, I just used <object src='somefile'></object> instead and included the encoding in the source file.

jQuery Ajax-load replaces page instead of div in IE9 (without developer tool mode-switching)

I'm working on a website where one of the pages has a list of articles and an option to filter these based on certain keywords. All the keywords are links and listed to the right of the list. In order to get the correct URL's, the links on each keywords hold part of the ajaxURL that would give the correct response for the given keyword. In addition, I got a script that adds a 'click'-event to all links and appends the last required parameters to the ajaxURL. I "reload" the list by using jQuery's 'load'-function, like this:
$('a.keyword').click(function(event){
event.preventDefault();
// Other logic
$('.list').load(ajaxURL);
}
However, when using the filter in IE9 the content of 'ajaxURL' is loaded into the entire page. That is, the entire page is replaced with the resulting list. I figured this could be a problem of only using 'event.preventDefault()' on the 'click'-event I got on each link, so I added a variety of alternatives:
event.stopPropagtion()
return false
if(event.preventDefault){
event.preventDefault();
} else {
event.returnValue = false;
}
After hours of debugging, trying different combinations of these and trying IE7, IE8 and IE9 using the developer tool provided in IE, I realized that the first time I open the page with IE9 (without opening the developer tool), I get the problem described above. However, when I open the developer tool and selects IE8 it all works perfectly! The same happens when I change it back to IE9! (In this case I used all the alternatives above.)
For some reason, these transitions make it work! I can't figure out how to fix this.. I can't force users to open developer tool and switch mode to make i work. :P Any ideas? Does the developer tool add something that could do this?
I appreciate any help on the matter! :-)
PS. It works just fine in Chrome, ++.
The only thing I can think of is having console.log() in your script. That statement throws a Javascript error in IE up until you open the Developer Tools.
If that occurs earlier than the code you provided in the question then the rest of your script probably won't get evaluated, and your event handlers won't be bound at all, causing the links to just be regular links.

how to hide text in html page source?

I wanna show some text (and images) in browser but this text shouldn't be able to select in page preview or page source :
At first i tried to use canvas, but managing text and also images in canvas is not easy and for this case i can't use canvas.
I tried to use image but in this case, image is too slow to load.
I used ROT13 encryption in Aptana studio, but ROT13 just encrypt page source with JS and when you click on 'inspect element' in chrome or opera you can see decrypt text and html yet.
Question: Is there any way in jquery or anything else?
No, whatever you display as text in webpage can be found by digging into the source of the webpage (including js). What would this be useful for btw.?
Edit: This looks useful but ends up using canvas or flash I believe. Still might be tuned to be fairly fast and therefor useful:
http://eric-blue.com/2010/01/03/how-to-create-your-own-personal-document-viewer-like-scribd-or-google-books/
You most likely won't find a way to do this easily, as when the browser downloads the page, in order to show the text to the user it has to be decoded or decrypted. So no matter what, if the user can see it, they can copy it. If all you want is to block selection in the browser, this answer should help
No, if you want to place something on the page a browser need to know what you want to place on the page. And everything what was sent to the browser is readable for a user. So you cannot do this.
The answer is very simple: If you don't want to publish something don't place it on the internet.
yes, this my logic check out
make you string in ascii code and write on document
check below link and find example may you help
Link W3School
I guess no one could do that.
Just use some image instead, old-style, but useful.

#hash added by firefox and ie at the end of url in search-results page (Google personal search)

Is there any way to avoid firefox and IE to reload the page adding the hash-tag to the url.
Due to that I have to refine results by time with adding &as_qdr=d to the end of url, I have a problem with these hashtags in url, because anything behind them seems to be unfunctional.
It does not happen with Chrome, but Firefox reloads the page after query adding this nightmare hash:
d?=¿)a¿?)!!m!!"!"·n
My form is here
I need a javascript to block Firefox (at least) to reload adding the hash-tag
I know this is an old question but I had a similar problem.
Turns out it was the href="#" when handling the onclick event.
Use href="javascript:void(0)"
A more complete answer is here
The linked site doesn't give much to test/work with. Maybe it's the language barrier, but it was not entirely clear to me how I am supposed to interact with the site so that I can try to reproduce the problem. In the future questions, try to add clear steps how to reproduce the problem.
At least, I would revise the way of appending query parameters to end of URL. The symptoms make it much look like that you're blindly appending them to the very end of the entire URL without determining/filtering the URL itself. I suggest you to use window.location.search to obtain the current query string and then build on that further. It won't include the hash fragments.
Thank you very much for your kind answer.
I will try to let you have a run on the form, the way a visitor would do it:
The site is a Job Meta-search machine, Google personal search, (no revenues for the moment otherwise I wouldn't bother anyone here)
You begin at: http://infoprofesionales.es/pageID_10075646.html
and introduce e.g "manager", enter, then redirect to result page:
chrome:
...INFOPROFES.ROOT.../pageID_results.html?cx=partner-pub-8427202809546935:rxxaj8en2yh&cof=FORID:10&ie=UTF-8&q=manger&sa=Buscar+en+60+Portales+(escriba+empleo+y+lugar+de+trabajo)
firefox:
...INFOPROFES.ROOT.../pageID_results.html?cx=partner-pub-8427202809546935%3Arxxaj8en2yh&cof=FORID%3A10&ie=UTF-8&q=manager&sa=Buscar+en+60+Portales+(escriba+empleo+y+lugar+de+trabajo)#1346
As you see FF ads the hashtag
I redirect because the result page offers three buttons which add by JavaScript the internal Google parameter (filter:time):
&as_qdr=w week or d day or h hour (brilliant way to filter results not compromising the Google code (which is not allowed)
So now I`ll come to an end and it is really simple:
These appendixes (&as_qdr=X) are added by the mentioned buttons to the end of the URL, and (which works in Chrome) cause a reload showing the desired filtered results.
BUT: Firefox won't work, why? because FF forces a double load (you can appreciate it lowering conn.speed) adding the second time an hash tag to the end of the url.And behind that tag: none of my parmeters takes any effect.
Chrome: no hash tag = WORKS (try and press my yellow filter links at the bottom of result site)
Firefox & IE hash tag = DOES NOT WORK (try and you will see my "&as_qdr=X" parameter behind the tag, but not igniting like in chrome)
I had to lower myself writing on the site "works only with Chrome" which is ridiculous - and I spent all kind of attempts from manipulating by java the string location, stop loading or whatever...
Never so much in vain.
It seems to lie on the hand: FF & IE load searchresults twice, first without tag then with ¿How forbid them loading twice (looks ugly anyhow).

Categories