change filter to get a file with and without additional url querystring

Related searches

I want to get a single css file from a page, so I do this:

let sheets = window.document.styleSheets;
var mysheet = Array.from(sheets).filter(mysheet => 
    mysheet.href == PAGERL+'/css/my_wanted_file.css');

As a result I get the complete path of the "my_wanted_file.css" file.

Now I have the situation, that cause of a reload function, the name of the wanted file looks like "my_wanted_file.css?t=timestamp"

What I have to change in the code above, that this code will output the wanted file in case with and without the "?t=timestamp" part?

Thanks a lot.

Don’t look at href to begin with, if you are not interested in the full URL …?

JavaScript provides you with a way to look at specific parts of a URL only already, https://developer.mozilla.org/en-US/docs/Web/API/URL#Properties

mysheet.pathname == '/css/my_wanted_file.css'

node.js with express how to remove the query string from the url , Use url.parse() to get the components of your address, which is req.url . The url without the query string is stored in the pathname property. page by forcing a redirect, I added the following to the <head> section of my .ejs file: a string and replace it in the history API const cleanUrl = location.href.match(/^. Or you could add query string parameters to the URL to pre-filter the report. Perhaps you have a report you'd like to show colleagues and you want to pre-filter it for them. One way to filter it is to start with the default URL for the report, add the filter parameters to the URL, and then email them the entire new URL.

Try to use OR || operator:

var mysheet = Array.from(sheets).filter(mysheet => 
    { 
      return mysheet.href == PAGERL+'/css/my_wanted_file.css'
         || mysheet.href == '/css/my_wanted_file.css'
    });

UPDATE:

If you want to check whether array contains values such as /css/my_wanted_file.css or /css/my_wanted_file.css?t=timestamp:

let timestamp = 'yourTimeStamp Here';
var mysheet = Array.from(sheets).filter(mysheet => 
    { 
      return mysheet.href == PAGERL+'/css/my_wanted_file.css'
         || mysheet.href ==  PAGERL+`/css/my_wanted_file.css?t=${timestamp}`
    });

How To Exclude URL Query Parameters in Google Analytics , Clean up your pages and get better content reporting in Google Analytics with these in which case you'll start to see your pages grouped into (other). so the View Settings and filters do not stop the data from being collected and to be removed from URL var params = ['name', 'email']; var a = document. The report has some filters (slicers) like "date", "companyName", "owner" and nobody wants to see info from others, they want to see always his rows without click in all the filters. There is any chance to use the original URL + some parameters, or using API rest or somethign like that to customize the filters?

After a lot of good suggestions, i decide to solve the problem in a simple way.

Split the url by the questionmark and work with this :-)

if(mysheet.href!=undefined && mysheet.href.split('?')[0] == PAGERL+'/css/my_wanted_file.css'){ return mysheet.href; }

that's all ;-)

Easy URL Manipulation with URLSearchParams | Web, URLSearchParams trivial access and manipulation of the URL's query string. URLSearchParams API; Working with URLs; Integration with other places URLs Given a URL string, you can easily extract parameter values: Note: this example removes all person query parameters from the URL, not const a = document. We can see also in Query String filter web part that “this filter is not connected”. To give the web part connection to the SharePoint list we have to click on the drop-down option which is present in top right side corner of the Query String web part. Click on Connections we can find two options Send Filter Values to and Send default value to.

Using querySelector with contains attribute selector

document.querySelector('link[href*="/css/my_wanted_file.css"]')

Fix max URL and query string length with web.config and IIS, query strings. Without it, your web server may return 404s to your users. Fix max URL and query string length with web.config and IIS. AddThis The request filtering module is configured to deny a request where the query string is too long To do so, modify the security element in the web.config file: So all you need to do is just change part of the source connection (the database name, or the file name, or folder path, or the API URL etc). You can do these with changing values in Power Query Editor window. but that means you need to open the file in Power BI Desktop, change the value, save and re-publish it into the service.

Creating URL query strings in Python, How to make Python do the tedious work of creating URL query strings. A typical URL looks very much like a system file path, e.g. And let's change where the map is centered around with the center parameter, which takes any string that describes a OK, adding multiple markers is where things get slightly complicated. The following table shows the filters that are supported in Dynamics NAV OData web services and the equivalent C/AL filter expressions. All examples are based either on page 21, Customer (published as Customer ), or on page 20, General Ledger Entry (published as GLEntry ).

Rather than create a bunch of different custom views, I was wondering if there is a way to just pass some URL arguments to the AllItems.aspx page and have the filter be applied during page load. I envision maybe create a text box where they can type a question like "DocumentID" and give it a value of "12345" - then have javascript construct an

Using query string values to filter data with model binding and web forms. 02/27/2014; 3 minutes to read; In this article. by Tom FitzMacken. This tutorial series demonstrates basic aspects of using model binding with an ASP.NET Web Forms project.

Comments
  • href is ok, i need the complete url. maybe there is a missunderstanding. The problem is the querystring "?t=timestamp" - wich is sometime on the end of the filename. If it is, the function dont return the file.
  • "i need the complete url" - this doesn’t mean you lose access to it, I just changed the part where you compare it to filter your array. The resulting elements inside var mysheet will still have all those properties, they didn’t get removed just because you read something else in the filter callback function.
  • sorry - what you mean. i think i have to add or change something in the filter nearly the answear of @Aswin Kumar !?
  • Replace mysheet.href == PAGERL+'/css/my_wanted_file.css' in your original code with what I’ve shown here, no more, no less.
  • (And do you need to exclude stylesheets from other domains that might have the same URL path? If so, that condifion alone won’t cut it, but the other URL properties can be compared the same way, and the conditions joined by &&)
  • maybe there is a missunderstanding. The problem is not to check if the file is with or without the "PAGERL". The problem is the querystring "?t=timestamp"
  • @Greg do you mean after reloading of a page, then you don't need PAGERL parameter into filter function?
  • There is no problem with PAGERL. I've only check if the "my_wanted.css" or "my_wanted.css?t=timestamp" is avivable. At the moment it works only for "my_wanted.css"
  • "timestamp" is no fix text, it should be a placeholder for a real unix-timestampe I thinks it should be a kind like my_wanted_file.css* ?
  • no it wont work, the timestamp is unkown - did you have another idear?
  • looks interesting - how i can use this inside my code?